2019-05-28 16:57:24 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2010-09-13 14:05:04 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) ST-Ericsson SA 2010
|
|
|
|
*
|
|
|
|
* Author: Mattias Wallin <mattias.wallin@stericsson.com> for ST-Ericsson.
|
|
|
|
*/
|
2011-04-08 14:26:36 +00:00
|
|
|
/*
|
|
|
|
* AB8500 register access
|
|
|
|
* ======================
|
|
|
|
*
|
|
|
|
* read:
|
|
|
|
* # echo BANK > <debugfs>/ab8500/register-bank
|
|
|
|
* # echo ADDR > <debugfs>/ab8500/register-address
|
|
|
|
* # cat <debugfs>/ab8500/register-value
|
|
|
|
*
|
|
|
|
* write:
|
|
|
|
* # echo BANK > <debugfs>/ab8500/register-bank
|
|
|
|
* # echo ADDR > <debugfs>/ab8500/register-address
|
|
|
|
* # echo VALUE > <debugfs>/ab8500/register-value
|
|
|
|
*
|
|
|
|
* read all registers from a bank:
|
|
|
|
* # echo BANK > <debugfs>/ab8500/register-bank
|
|
|
|
* # cat <debugfs>/ab8500/all-bank-register
|
|
|
|
*
|
|
|
|
* BANK target AB8500 register bank
|
|
|
|
* ADDR target AB8500 register address
|
|
|
|
* VALUE decimal or 0x-prefixed hexadecimal
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* User Space notification on AB8500 IRQ
|
|
|
|
* =====================================
|
|
|
|
*
|
|
|
|
* Allows user space entity to be notified when target AB8500 IRQ occurs.
|
|
|
|
* When subscribed, a sysfs entry is created in ab8500.i2c platform device.
|
|
|
|
* One can pool this file to get target IRQ occurence information.
|
|
|
|
*
|
|
|
|
* subscribe to an AB8500 IRQ:
|
|
|
|
* # echo IRQ > <debugfs>/ab8500/irq-subscribe
|
|
|
|
*
|
|
|
|
* unsubscribe from an AB8500 IRQ:
|
|
|
|
* # echo IRQ > <debugfs>/ab8500/irq-unsubscribe
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* AB8500 register formated read/write access
|
|
|
|
* ==========================================
|
|
|
|
*
|
|
|
|
* Read: read data, data>>SHIFT, data&=MASK, output data
|
|
|
|
* [0xABCDEF98] shift=12 mask=0xFFF => 0x00000CDE
|
|
|
|
* Write: read data, data &= ~(MASK<<SHIFT), data |= (VALUE<<SHIFT), write data
|
|
|
|
* [0xABCDEF98] shift=12 mask=0xFFF value=0x123 => [0xAB123F98]
|
|
|
|
*
|
|
|
|
* Usage:
|
|
|
|
* # echo "CMD [OPTIONS] BANK ADRESS [VALUE]" > $debugfs/ab8500/hwreg
|
|
|
|
*
|
|
|
|
* CMD read read access
|
|
|
|
* write write access
|
|
|
|
*
|
|
|
|
* BANK target reg bank
|
|
|
|
* ADDRESS target reg address
|
|
|
|
* VALUE (write) value to be updated
|
|
|
|
*
|
|
|
|
* OPTIONS
|
|
|
|
* -d|-dec (read) output in decimal
|
|
|
|
* -h|-hexa (read) output in 0x-hexa (default)
|
|
|
|
* -l|-w|-b 32bit (default), 16bit or 8bit reg access
|
|
|
|
* -m|-mask MASK 0x-hexa mask (default 0xFFFFFFFF)
|
|
|
|
* -s|-shift SHIFT bit shift value (read:left, write:right)
|
|
|
|
* -o|-offset OFFSET address offset to add to ADDRESS value
|
|
|
|
*
|
|
|
|
* Warning: bit shift operation is applied to bit-mask.
|
|
|
|
* Warning: bit shift direction depends on read or right command.
|
|
|
|
*/
|
2010-09-13 14:05:04 +00:00
|
|
|
|
|
|
|
#include <linux/seq_file.h>
|
|
|
|
#include <linux/uaccess.h>
|
|
|
|
#include <linux/fs.h>
|
2016-10-30 01:24:37 +00:00
|
|
|
#include <linux/init.h>
|
2010-09-13 14:05:04 +00:00
|
|
|
#include <linux/debugfs.h>
|
|
|
|
#include <linux/platform_device.h>
|
2013-01-14 16:10:36 +00:00
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <linux/kobject.h>
|
|
|
|
#include <linux/slab.h>
|
2012-05-31 05:57:07 +00:00
|
|
|
#include <linux/irq.h>
|
2010-09-13 14:05:04 +00:00
|
|
|
|
|
|
|
#include <linux/mfd/abx500.h>
|
2013-02-06 22:23:01 +00:00
|
|
|
#include <linux/mfd/abx500/ab8500.h>
|
2010-09-13 14:05:04 +00:00
|
|
|
|
2011-04-08 14:26:36 +00:00
|
|
|
#ifdef CONFIG_DEBUG_FS
|
|
|
|
#include <linux/string.h>
|
|
|
|
#include <linux/ctype.h>
|
|
|
|
#endif
|
|
|
|
|
2010-09-13 14:05:04 +00:00
|
|
|
static u32 debug_bank;
|
|
|
|
static u32 debug_address;
|
|
|
|
|
2013-04-12 15:02:09 +00:00
|
|
|
static int irq_ab8500;
|
2013-01-14 16:10:36 +00:00
|
|
|
static int irq_first;
|
|
|
|
static int irq_last;
|
2012-02-03 10:19:05 +00:00
|
|
|
static u32 *irq_count;
|
|
|
|
static int num_irqs;
|
2010-11-19 16:55:11 +00:00
|
|
|
|
2012-02-03 10:19:05 +00:00
|
|
|
static struct device_attribute **dev_attr;
|
|
|
|
static char **event_name;
|
2013-01-14 16:10:36 +00:00
|
|
|
|
2010-09-13 14:05:04 +00:00
|
|
|
/**
|
|
|
|
* struct ab8500_reg_range
|
|
|
|
* @first: the first address of the range
|
|
|
|
* @last: the last address of the range
|
|
|
|
* @perm: access permissions for the range
|
|
|
|
*/
|
|
|
|
struct ab8500_reg_range {
|
2010-11-26 12:06:39 +00:00
|
|
|
u8 first;
|
|
|
|
u8 last;
|
|
|
|
u8 perm;
|
2010-09-13 14:05:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2012-06-20 12:56:38 +00:00
|
|
|
* struct ab8500_prcmu_ranges
|
2010-09-13 14:05:04 +00:00
|
|
|
* @num_ranges: the number of ranges in the list
|
|
|
|
* @bankid: bank identifier
|
|
|
|
* @range: the list of register ranges
|
|
|
|
*/
|
2012-06-20 12:56:38 +00:00
|
|
|
struct ab8500_prcmu_ranges {
|
2010-11-26 12:06:39 +00:00
|
|
|
u8 num_ranges;
|
|
|
|
u8 bankid;
|
|
|
|
const struct ab8500_reg_range *range;
|
2010-09-13 14:05:04 +00:00
|
|
|
};
|
|
|
|
|
2011-04-08 14:26:36 +00:00
|
|
|
/* hwreg- "mask" and "shift" entries ressources */
|
|
|
|
struct hwreg_cfg {
|
|
|
|
u32 bank; /* target bank */
|
mfd: ab8500-debugfs: BIG clean-up
When checkpatch is run on ab8500-debugfs.c it screamed blue murder!
This patch fixes up all of the errors/warnings reported:
WARNING: line over 80 characters
+ err = seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO"ab8500 register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" bank 0x%02X:\n", i);
WARNING: externs should be avoided in .c files
+extern int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
WARNING: quoted string split across lines
+ pr_info("Saving all ABB registers at \"ab8500_complete_register_dump\" "
+ "for crash analyze.\n");
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "abx500_set_reg failed %d, %d", err, __LINE__);
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, "name: number: number of: wake:\n");
WARNING: line over 80 characters
+ return single_open(file, ab8500_print_modem_registers, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_btemp_ball_print, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_main_bat_v_print, inode->i_private);
WARNING: line over 80 characters
+ vbat_true_meas_convert = ab8500_gpadc_ad_to_voltage(gpadc, VBAT_TRUE_MEAS,
WARNING: line over 80 characters
+static int ab8540_gpadc_vbat_true_meas_and_ibat_print(struct seq_file *s, void *p)
WARNING: line over 80 characters
+static const struct file_operations ab8540_gpadc_vbat_true_meas_and_ibat_fops = {
WARNING: line over 80 characters
+ vmain_l, vmain_h, btemp_l, btemp_h, vbat_l, vbat_h, ibat_l, ibat_h);
WARNING: quoted string split across lines
+ dev_err(dev, "debugfs error input: "
+ "should be egal to 1, 4, 8 or 16\n");
WARNING: Missing a blank line after declarations
+ char *s = b;
+ if ((*s == '0') && ((*(s+1) == 'x') || (*(s+1) == 'X'))) {
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.mask = simple_strtoul(b, &b, 0);
WARNING: simple_strtol is obsolete, use kstrtol instead
+ loc.shift = simple_strtol(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.bank = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.addr = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ val = simple_strtoul(b, &b, 0);
WARNING: quoted string split across lines
+ pr_warn("HWREG request: %s, %s, addr=0x%08X, mask=0x%X, shift=%d"
+ "value=0x%X\n", (write) ? "write" : "read",
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "sysfs_create_file failed %d\n", err);
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "request_threaded_irq failed %d, %lu\n",
ERROR: code indent should use tabs where possible
+ err, user_val);$
WARNING: please, no spaces at the start of a line
+ err, user_val);$
WARNING: Missing a blank line after declarations
+ struct resource *res;
+ debug_bank = AB8500_MISC;
ERROR: space required after that ',' (ctx:VxV)
+ sizeof(*dev_attr)*num_irqs,GFP_KERNEL);
^
WARNING: return of an errno should typically be -ve (return -ENXIO)
+ return ENXIO;
WARNING: line over 80 characters
+ file = debugfs_create_file("register-bank", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-address", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-value", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-subscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-unsubscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("all-modem-registers", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_v", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("usb_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("xtal_temp", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_xtal_temp_fops);
WARNING: line over 80 characters
+ file = debugfs_create_file("vbattruemeas", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("otp_calib", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_otp_calib_fops);
total: 2 errors, 44 warnings, 3230 lines checked
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-14 17:29:16 +00:00
|
|
|
unsigned long addr; /* target address */
|
2011-04-08 14:26:36 +00:00
|
|
|
uint fmt; /* format */
|
mfd: ab8500-debugfs: BIG clean-up
When checkpatch is run on ab8500-debugfs.c it screamed blue murder!
This patch fixes up all of the errors/warnings reported:
WARNING: line over 80 characters
+ err = seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO"ab8500 register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" bank 0x%02X:\n", i);
WARNING: externs should be avoided in .c files
+extern int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
WARNING: quoted string split across lines
+ pr_info("Saving all ABB registers at \"ab8500_complete_register_dump\" "
+ "for crash analyze.\n");
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "abx500_set_reg failed %d, %d", err, __LINE__);
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, "name: number: number of: wake:\n");
WARNING: line over 80 characters
+ return single_open(file, ab8500_print_modem_registers, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_btemp_ball_print, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_main_bat_v_print, inode->i_private);
WARNING: line over 80 characters
+ vbat_true_meas_convert = ab8500_gpadc_ad_to_voltage(gpadc, VBAT_TRUE_MEAS,
WARNING: line over 80 characters
+static int ab8540_gpadc_vbat_true_meas_and_ibat_print(struct seq_file *s, void *p)
WARNING: line over 80 characters
+static const struct file_operations ab8540_gpadc_vbat_true_meas_and_ibat_fops = {
WARNING: line over 80 characters
+ vmain_l, vmain_h, btemp_l, btemp_h, vbat_l, vbat_h, ibat_l, ibat_h);
WARNING: quoted string split across lines
+ dev_err(dev, "debugfs error input: "
+ "should be egal to 1, 4, 8 or 16\n");
WARNING: Missing a blank line after declarations
+ char *s = b;
+ if ((*s == '0') && ((*(s+1) == 'x') || (*(s+1) == 'X'))) {
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.mask = simple_strtoul(b, &b, 0);
WARNING: simple_strtol is obsolete, use kstrtol instead
+ loc.shift = simple_strtol(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.bank = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.addr = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ val = simple_strtoul(b, &b, 0);
WARNING: quoted string split across lines
+ pr_warn("HWREG request: %s, %s, addr=0x%08X, mask=0x%X, shift=%d"
+ "value=0x%X\n", (write) ? "write" : "read",
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "sysfs_create_file failed %d\n", err);
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "request_threaded_irq failed %d, %lu\n",
ERROR: code indent should use tabs where possible
+ err, user_val);$
WARNING: please, no spaces at the start of a line
+ err, user_val);$
WARNING: Missing a blank line after declarations
+ struct resource *res;
+ debug_bank = AB8500_MISC;
ERROR: space required after that ',' (ctx:VxV)
+ sizeof(*dev_attr)*num_irqs,GFP_KERNEL);
^
WARNING: return of an errno should typically be -ve (return -ENXIO)
+ return ENXIO;
WARNING: line over 80 characters
+ file = debugfs_create_file("register-bank", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-address", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-value", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-subscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-unsubscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("all-modem-registers", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_v", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("usb_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("xtal_temp", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_xtal_temp_fops);
WARNING: line over 80 characters
+ file = debugfs_create_file("vbattruemeas", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("otp_calib", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_otp_calib_fops);
total: 2 errors, 44 warnings, 3230 lines checked
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-14 17:29:16 +00:00
|
|
|
unsigned long mask; /* read/write mask, applied before any bit shift */
|
|
|
|
long shift; /* bit shift (read:right shift, write:left shift */
|
2011-04-08 14:26:36 +00:00
|
|
|
};
|
|
|
|
/* fmt bit #0: 0=hexa, 1=dec */
|
|
|
|
#define REG_FMT_DEC(c) ((c)->fmt & 0x1)
|
|
|
|
#define REG_FMT_HEX(c) (!REG_FMT_DEC(c))
|
|
|
|
|
|
|
|
static struct hwreg_cfg hwreg_cfg = {
|
|
|
|
.addr = 0, /* default: invalid phys addr */
|
|
|
|
.fmt = 0, /* default: 32bit access, hex output */
|
|
|
|
.mask = 0xFFFFFFFF, /* default: no mask */
|
|
|
|
.shift = 0, /* default: no bit shift */
|
|
|
|
};
|
|
|
|
|
2010-09-13 14:05:04 +00:00
|
|
|
#define AB8500_NAME_STRING "ab8500"
|
2016-09-14 10:14:30 +00:00
|
|
|
#define AB8500_NUM_BANKS AB8500_DEBUG_FIELD_LAST
|
2010-09-13 14:05:04 +00:00
|
|
|
|
|
|
|
#define AB8500_REV_REG 0x80
|
|
|
|
|
2012-07-06 14:11:50 +00:00
|
|
|
static struct ab8500_prcmu_ranges *debug_ranges;
|
|
|
|
|
2013-08-23 12:07:42 +00:00
|
|
|
static struct ab8500_prcmu_ranges ab8500_debug_ranges[AB8500_NUM_BANKS] = {
|
2016-09-14 10:14:30 +00:00
|
|
|
[AB8500_M_FSM_RANK] = {
|
2010-11-26 12:06:39 +00:00
|
|
|
.num_ranges = 0,
|
2013-01-14 17:17:34 +00:00
|
|
|
.range = NULL,
|
2010-11-26 12:06:39 +00:00
|
|
|
},
|
|
|
|
[AB8500_SYS_CTRL1_BLOCK] = {
|
|
|
|
.num_ranges = 3,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x02,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x42,
|
|
|
|
.last = 0x42,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x80,
|
|
|
|
.last = 0x81,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_SYS_CTRL2_BLOCK] = {
|
|
|
|
.num_ranges = 4,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x0D,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x0F,
|
|
|
|
.last = 0x17,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x30,
|
|
|
|
.last = 0x30,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x32,
|
|
|
|
.last = 0x33,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_REGU_CTRL1] = {
|
|
|
|
.num_ranges = 3,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x00,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x03,
|
|
|
|
.last = 0x10,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x80,
|
|
|
|
.last = 0x84,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_REGU_CTRL2] = {
|
|
|
|
.num_ranges = 5,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x15,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x17,
|
|
|
|
.last = 0x19,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x1B,
|
|
|
|
.last = 0x1D,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x1F,
|
|
|
|
.last = 0x22,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x40,
|
|
|
|
.last = 0x44,
|
|
|
|
},
|
2015-10-28 09:27:32 +00:00
|
|
|
/*
|
|
|
|
* 0x80-0x8B are SIM registers and should
|
|
|
|
* not be accessed from here
|
|
|
|
*/
|
2010-11-26 12:06:39 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_USB] = {
|
|
|
|
.num_ranges = 2,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x80,
|
|
|
|
.last = 0x83,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x87,
|
|
|
|
.last = 0x8A,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_TVOUT] = {
|
|
|
|
.num_ranges = 9,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x12,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x15,
|
|
|
|
.last = 0x17,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x19,
|
|
|
|
.last = 0x21,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x27,
|
|
|
|
.last = 0x2C,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x41,
|
|
|
|
.last = 0x41,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x45,
|
|
|
|
.last = 0x5B,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x5D,
|
|
|
|
.last = 0x5D,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x69,
|
|
|
|
.last = 0x69,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x80,
|
|
|
|
.last = 0x81,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_DBI] = {
|
|
|
|
.num_ranges = 0,
|
2010-12-13 14:06:47 +00:00
|
|
|
.range = NULL,
|
2010-11-26 12:06:39 +00:00
|
|
|
},
|
|
|
|
[AB8500_ECI_AV_ACC] = {
|
|
|
|
.num_ranges = 1,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x80,
|
|
|
|
.last = 0x82,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2016-09-14 10:14:30 +00:00
|
|
|
[AB8500_RESERVED] = {
|
2010-11-26 12:06:39 +00:00
|
|
|
.num_ranges = 0,
|
2010-12-13 14:06:47 +00:00
|
|
|
.range = NULL,
|
2010-11-26 12:06:39 +00:00
|
|
|
},
|
|
|
|
[AB8500_GPADC] = {
|
|
|
|
.num_ranges = 1,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x08,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_CHARGER] = {
|
2011-10-17 07:48:55 +00:00
|
|
|
.num_ranges = 9,
|
2010-11-26 12:06:39 +00:00
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x03,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x05,
|
|
|
|
.last = 0x05,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x40,
|
|
|
|
.last = 0x40,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x42,
|
|
|
|
.last = 0x42,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x44,
|
|
|
|
.last = 0x44,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x50,
|
|
|
|
.last = 0x55,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x80,
|
|
|
|
.last = 0x82,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0xC0,
|
|
|
|
.last = 0xC2,
|
|
|
|
},
|
2011-10-17 07:48:55 +00:00
|
|
|
{
|
|
|
|
.first = 0xf5,
|
2012-07-06 14:11:50 +00:00
|
|
|
.last = 0xf6,
|
2011-10-17 07:48:55 +00:00
|
|
|
},
|
2010-11-26 12:06:39 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_GAS_GAUGE] = {
|
|
|
|
.num_ranges = 3,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x00,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x07,
|
|
|
|
.last = 0x0A,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x10,
|
|
|
|
.last = 0x14,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_AUDIO] = {
|
|
|
|
.num_ranges = 1,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x6F,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_INTERRUPT] = {
|
|
|
|
.num_ranges = 0,
|
2010-12-13 14:06:47 +00:00
|
|
|
.range = NULL,
|
2010-11-26 12:06:39 +00:00
|
|
|
},
|
|
|
|
[AB8500_RTC] = {
|
|
|
|
.num_ranges = 1,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x0F,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_MISC] = {
|
|
|
|
.num_ranges = 8,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x05,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x10,
|
|
|
|
.last = 0x15,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x20,
|
|
|
|
.last = 0x25,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x30,
|
|
|
|
.last = 0x35,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x40,
|
|
|
|
.last = 0x45,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x50,
|
|
|
|
.last = 0x50,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x60,
|
|
|
|
.last = 0x67,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x80,
|
|
|
|
.last = 0x80,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2016-09-14 10:14:30 +00:00
|
|
|
[AB8500_DEVELOPMENT] = {
|
|
|
|
.num_ranges = 1,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x00,
|
|
|
|
},
|
|
|
|
},
|
2010-11-26 12:06:39 +00:00
|
|
|
},
|
2016-09-14 10:14:30 +00:00
|
|
|
[AB8500_DEBUG] = {
|
|
|
|
.num_ranges = 1,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x05,
|
|
|
|
.last = 0x07,
|
|
|
|
},
|
|
|
|
},
|
2010-11-26 12:06:39 +00:00
|
|
|
},
|
2016-09-14 10:14:30 +00:00
|
|
|
[AB8500_PROD_TEST] = {
|
2010-11-26 12:06:39 +00:00
|
|
|
.num_ranges = 0,
|
2010-12-13 14:06:47 +00:00
|
|
|
.range = NULL,
|
2010-11-26 12:06:39 +00:00
|
|
|
},
|
2016-09-14 10:14:30 +00:00
|
|
|
[AB8500_STE_TEST] = {
|
2010-11-26 12:06:39 +00:00
|
|
|
.num_ranges = 0,
|
2010-12-13 14:06:47 +00:00
|
|
|
.range = NULL,
|
2010-11-26 12:06:39 +00:00
|
|
|
},
|
|
|
|
[AB8500_OTP_EMUL] = {
|
|
|
|
.num_ranges = 1,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x01,
|
|
|
|
.last = 0x0F,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2010-09-13 14:05:04 +00:00
|
|
|
};
|
|
|
|
|
2013-08-23 12:07:42 +00:00
|
|
|
static struct ab8500_prcmu_ranges ab8505_debug_ranges[AB8500_NUM_BANKS] = {
|
2012-07-06 14:11:50 +00:00
|
|
|
[0x0] = {
|
|
|
|
.num_ranges = 0,
|
|
|
|
.range = NULL,
|
|
|
|
},
|
|
|
|
[AB8500_SYS_CTRL1_BLOCK] = {
|
|
|
|
.num_ranges = 5,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x04,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x42,
|
|
|
|
.last = 0x42,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x52,
|
|
|
|
.last = 0x52,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x54,
|
|
|
|
.last = 0x57,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x80,
|
|
|
|
.last = 0x83,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_SYS_CTRL2_BLOCK] = {
|
|
|
|
.num_ranges = 5,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x0D,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x0F,
|
|
|
|
.last = 0x17,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x20,
|
|
|
|
.last = 0x20,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x30,
|
|
|
|
.last = 0x30,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x32,
|
|
|
|
.last = 0x3A,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_REGU_CTRL1] = {
|
|
|
|
.num_ranges = 3,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x00,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x03,
|
|
|
|
.last = 0x11,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x80,
|
|
|
|
.last = 0x86,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_REGU_CTRL2] = {
|
|
|
|
.num_ranges = 6,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x06,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x08,
|
|
|
|
.last = 0x15,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x17,
|
|
|
|
.last = 0x19,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x1B,
|
|
|
|
.last = 0x1D,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x1F,
|
|
|
|
.last = 0x30,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x40,
|
|
|
|
.last = 0x48,
|
|
|
|
},
|
2015-10-28 09:27:32 +00:00
|
|
|
/*
|
|
|
|
* 0x80-0x8B are SIM registers and should
|
|
|
|
* not be accessed from here
|
|
|
|
*/
|
2012-07-06 14:11:50 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_USB] = {
|
|
|
|
.num_ranges = 3,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x80,
|
|
|
|
.last = 0x83,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x87,
|
|
|
|
.last = 0x8A,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x91,
|
|
|
|
.last = 0x94,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_TVOUT] = {
|
|
|
|
.num_ranges = 0,
|
|
|
|
.range = NULL,
|
|
|
|
},
|
|
|
|
[AB8500_DBI] = {
|
|
|
|
.num_ranges = 0,
|
|
|
|
.range = NULL,
|
|
|
|
},
|
|
|
|
[AB8500_ECI_AV_ACC] = {
|
|
|
|
.num_ranges = 1,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x80,
|
|
|
|
.last = 0x82,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_RESERVED] = {
|
|
|
|
.num_ranges = 0,
|
|
|
|
.range = NULL,
|
|
|
|
},
|
|
|
|
[AB8500_GPADC] = {
|
|
|
|
.num_ranges = 1,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x08,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_CHARGER] = {
|
|
|
|
.num_ranges = 9,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x02,
|
|
|
|
.last = 0x03,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x05,
|
|
|
|
.last = 0x05,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x40,
|
|
|
|
.last = 0x44,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x50,
|
|
|
|
.last = 0x57,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x60,
|
|
|
|
.last = 0x60,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0xA0,
|
|
|
|
.last = 0xA7,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0xAF,
|
|
|
|
.last = 0xB2,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0xC0,
|
|
|
|
.last = 0xC2,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0xF5,
|
|
|
|
.last = 0xF5,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_GAS_GAUGE] = {
|
|
|
|
.num_ranges = 3,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x00,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x07,
|
|
|
|
.last = 0x0A,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x10,
|
|
|
|
.last = 0x14,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_AUDIO] = {
|
|
|
|
.num_ranges = 1,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x83,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_INTERRUPT] = {
|
|
|
|
.num_ranges = 11,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x04,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x06,
|
|
|
|
.last = 0x07,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x09,
|
|
|
|
.last = 0x09,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x0B,
|
|
|
|
.last = 0x0C,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x12,
|
|
|
|
.last = 0x15,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x18,
|
|
|
|
.last = 0x18,
|
|
|
|
},
|
|
|
|
/* Latch registers should not be read here */
|
|
|
|
{
|
|
|
|
.first = 0x40,
|
|
|
|
.last = 0x44,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x46,
|
|
|
|
.last = 0x49,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x4B,
|
|
|
|
.last = 0x4D,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x52,
|
|
|
|
.last = 0x55,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x58,
|
|
|
|
.last = 0x58,
|
|
|
|
},
|
|
|
|
/* LatchHier registers should not be read here */
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_RTC] = {
|
|
|
|
.num_ranges = 2,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x14,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x16,
|
|
|
|
.last = 0x17,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_MISC] = {
|
|
|
|
.num_ranges = 8,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x06,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x10,
|
|
|
|
.last = 0x16,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x20,
|
|
|
|
.last = 0x26,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x30,
|
|
|
|
.last = 0x36,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x40,
|
|
|
|
.last = 0x46,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x50,
|
|
|
|
.last = 0x50,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x60,
|
|
|
|
.last = 0x6B,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x80,
|
|
|
|
.last = 0x82,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_DEVELOPMENT] = {
|
|
|
|
.num_ranges = 2,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x00,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x05,
|
|
|
|
.last = 0x05,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_DEBUG] = {
|
|
|
|
.num_ranges = 1,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x05,
|
|
|
|
.last = 0x07,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_PROD_TEST] = {
|
|
|
|
.num_ranges = 0,
|
|
|
|
.range = NULL,
|
|
|
|
},
|
|
|
|
[AB8500_STE_TEST] = {
|
|
|
|
.num_ranges = 0,
|
|
|
|
.range = NULL,
|
|
|
|
},
|
|
|
|
[AB8500_OTP_EMUL] = {
|
|
|
|
.num_ranges = 1,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x01,
|
|
|
|
.last = 0x15,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2013-08-23 12:07:42 +00:00
|
|
|
static struct ab8500_prcmu_ranges ab8540_debug_ranges[AB8500_NUM_BANKS] = {
|
2012-11-19 11:20:03 +00:00
|
|
|
[AB8500_M_FSM_RANK] = {
|
|
|
|
.num_ranges = 1,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x0B,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_SYS_CTRL1_BLOCK] = {
|
|
|
|
.num_ranges = 6,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x04,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x42,
|
|
|
|
.last = 0x42,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x50,
|
|
|
|
.last = 0x54,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x57,
|
|
|
|
.last = 0x57,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x80,
|
|
|
|
.last = 0x83,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x90,
|
|
|
|
.last = 0x90,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_SYS_CTRL2_BLOCK] = {
|
|
|
|
.num_ranges = 5,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x0D,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x0F,
|
|
|
|
.last = 0x10,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x20,
|
|
|
|
.last = 0x21,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x32,
|
|
|
|
.last = 0x3C,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x40,
|
|
|
|
.last = 0x42,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_REGU_CTRL1] = {
|
|
|
|
.num_ranges = 4,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x03,
|
|
|
|
.last = 0x15,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x20,
|
|
|
|
.last = 0x20,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x80,
|
|
|
|
.last = 0x85,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x87,
|
|
|
|
.last = 0x88,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_REGU_CTRL2] = {
|
|
|
|
.num_ranges = 8,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x06,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x08,
|
|
|
|
.last = 0x15,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x17,
|
|
|
|
.last = 0x19,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x1B,
|
|
|
|
.last = 0x1D,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x1F,
|
|
|
|
.last = 0x2F,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x31,
|
|
|
|
.last = 0x3A,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x43,
|
|
|
|
.last = 0x44,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x48,
|
|
|
|
.last = 0x49,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_USB] = {
|
|
|
|
.num_ranges = 3,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x80,
|
|
|
|
.last = 0x83,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x87,
|
|
|
|
.last = 0x8A,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x91,
|
|
|
|
.last = 0x94,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_TVOUT] = {
|
|
|
|
.num_ranges = 0,
|
|
|
|
.range = NULL
|
|
|
|
},
|
|
|
|
[AB8500_DBI] = {
|
|
|
|
.num_ranges = 4,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x07,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x10,
|
|
|
|
.last = 0x11,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x20,
|
|
|
|
.last = 0x21,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x30,
|
|
|
|
.last = 0x43,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_ECI_AV_ACC] = {
|
|
|
|
.num_ranges = 2,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x03,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x80,
|
|
|
|
.last = 0x82,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_RESERVED] = {
|
|
|
|
.num_ranges = 0,
|
|
|
|
.range = NULL,
|
|
|
|
},
|
|
|
|
[AB8500_GPADC] = {
|
|
|
|
.num_ranges = 4,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x01,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x04,
|
|
|
|
.last = 0x06,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x09,
|
|
|
|
.last = 0x0A,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x10,
|
|
|
|
.last = 0x14,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_CHARGER] = {
|
|
|
|
.num_ranges = 10,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x00,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x02,
|
|
|
|
.last = 0x05,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x40,
|
|
|
|
.last = 0x44,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x50,
|
|
|
|
.last = 0x57,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x60,
|
|
|
|
.last = 0x60,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x70,
|
|
|
|
.last = 0x70,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0xA0,
|
|
|
|
.last = 0xA9,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0xAF,
|
|
|
|
.last = 0xB2,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0xC0,
|
|
|
|
.last = 0xC6,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0xF5,
|
|
|
|
.last = 0xF5,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_GAS_GAUGE] = {
|
|
|
|
.num_ranges = 3,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x00,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x07,
|
|
|
|
.last = 0x0A,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x10,
|
|
|
|
.last = 0x14,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_AUDIO] = {
|
|
|
|
.num_ranges = 1,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x9f,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_INTERRUPT] = {
|
|
|
|
.num_ranges = 6,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x05,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x0B,
|
|
|
|
.last = 0x0D,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x12,
|
|
|
|
.last = 0x20,
|
|
|
|
},
|
|
|
|
/* Latch registers should not be read here */
|
|
|
|
{
|
|
|
|
.first = 0x40,
|
|
|
|
.last = 0x45,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x4B,
|
|
|
|
.last = 0x4D,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x52,
|
|
|
|
.last = 0x60,
|
|
|
|
},
|
|
|
|
/* LatchHier registers should not be read here */
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_RTC] = {
|
|
|
|
.num_ranges = 3,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x07,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x0B,
|
|
|
|
.last = 0x18,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x20,
|
|
|
|
.last = 0x25,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_MISC] = {
|
|
|
|
.num_ranges = 9,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x06,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x10,
|
|
|
|
.last = 0x16,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x20,
|
|
|
|
.last = 0x26,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x30,
|
|
|
|
.last = 0x36,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x40,
|
|
|
|
.last = 0x49,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x50,
|
|
|
|
.last = 0x50,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x60,
|
|
|
|
.last = 0x6B,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x70,
|
|
|
|
.last = 0x74,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x80,
|
|
|
|
.last = 0x82,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_DEVELOPMENT] = {
|
|
|
|
.num_ranges = 3,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x01,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x06,
|
|
|
|
.last = 0x06,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x10,
|
|
|
|
.last = 0x21,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_DEBUG] = {
|
|
|
|
.num_ranges = 3,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x01,
|
|
|
|
.last = 0x0C,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x0E,
|
|
|
|
.last = 0x11,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.first = 0x80,
|
|
|
|
.last = 0x81,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[AB8500_PROD_TEST] = {
|
|
|
|
.num_ranges = 0,
|
|
|
|
.range = NULL,
|
|
|
|
},
|
|
|
|
[AB8500_STE_TEST] = {
|
|
|
|
.num_ranges = 0,
|
|
|
|
.range = NULL,
|
|
|
|
},
|
|
|
|
[AB8500_OTP_EMUL] = {
|
|
|
|
.num_ranges = 1,
|
|
|
|
.range = (struct ab8500_reg_range[]) {
|
|
|
|
{
|
|
|
|
.first = 0x00,
|
|
|
|
.last = 0x3F,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2013-01-14 16:10:36 +00:00
|
|
|
static irqreturn_t ab8500_debug_handler(int irq, void *data)
|
|
|
|
{
|
|
|
|
char buf[16];
|
|
|
|
struct kobject *kobj = (struct kobject *)data;
|
2010-11-19 16:55:11 +00:00
|
|
|
unsigned int irq_abb = irq - irq_first;
|
2013-01-14 16:10:36 +00:00
|
|
|
|
2012-02-03 10:19:05 +00:00
|
|
|
if (irq_abb < num_irqs)
|
2010-11-19 16:55:11 +00:00
|
|
|
irq_count[irq_abb]++;
|
2013-01-14 16:10:36 +00:00
|
|
|
/*
|
2018-02-11 22:34:03 +00:00
|
|
|
* This makes it possible to use poll for events (EPOLLPRI | EPOLLERR)
|
2010-11-19 16:55:11 +00:00
|
|
|
* from userspace on sysfs file named <irq-nr>
|
2013-01-14 16:10:36 +00:00
|
|
|
*/
|
2010-11-19 16:55:11 +00:00
|
|
|
sprintf(buf, "%d", irq);
|
2013-01-14 16:10:36 +00:00
|
|
|
sysfs_notify(kobj, NULL, buf);
|
|
|
|
|
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
2012-01-26 14:39:20 +00:00
|
|
|
/* Prints to seq_file or log_buf */
|
|
|
|
static int ab8500_registers_print(struct device *dev, u32 bank,
|
2015-02-22 02:53:43 +00:00
|
|
|
struct seq_file *s)
|
2010-09-13 14:05:04 +00:00
|
|
|
{
|
2010-11-26 12:06:39 +00:00
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
for (i = 0; i < debug_ranges[bank].num_ranges; i++) {
|
|
|
|
u32 reg;
|
|
|
|
|
|
|
|
for (reg = debug_ranges[bank].range[i].first;
|
|
|
|
reg <= debug_ranges[bank].range[i].last;
|
|
|
|
reg++) {
|
|
|
|
u8 value;
|
|
|
|
int err;
|
|
|
|
|
|
|
|
err = abx500_get_register_interruptible(dev,
|
|
|
|
(u8)bank, (u8)reg, &value);
|
|
|
|
if (err < 0) {
|
|
|
|
dev_err(dev, "ab->read fail %d\n", err);
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2012-01-26 14:39:20 +00:00
|
|
|
if (s) {
|
2015-02-22 02:53:43 +00:00
|
|
|
seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n",
|
|
|
|
bank, reg, value);
|
2015-10-28 09:27:32 +00:00
|
|
|
/*
|
|
|
|
* Error is not returned here since
|
|
|
|
* the output is wanted in any case
|
|
|
|
*/
|
2015-02-22 02:53:43 +00:00
|
|
|
if (seq_has_overflowed(s))
|
2012-01-26 14:39:20 +00:00
|
|
|
return 0;
|
|
|
|
} else {
|
mfd: ab8500-debugfs: BIG clean-up
When checkpatch is run on ab8500-debugfs.c it screamed blue murder!
This patch fixes up all of the errors/warnings reported:
WARNING: line over 80 characters
+ err = seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO"ab8500 register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" bank 0x%02X:\n", i);
WARNING: externs should be avoided in .c files
+extern int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
WARNING: quoted string split across lines
+ pr_info("Saving all ABB registers at \"ab8500_complete_register_dump\" "
+ "for crash analyze.\n");
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "abx500_set_reg failed %d, %d", err, __LINE__);
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, "name: number: number of: wake:\n");
WARNING: line over 80 characters
+ return single_open(file, ab8500_print_modem_registers, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_btemp_ball_print, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_main_bat_v_print, inode->i_private);
WARNING: line over 80 characters
+ vbat_true_meas_convert = ab8500_gpadc_ad_to_voltage(gpadc, VBAT_TRUE_MEAS,
WARNING: line over 80 characters
+static int ab8540_gpadc_vbat_true_meas_and_ibat_print(struct seq_file *s, void *p)
WARNING: line over 80 characters
+static const struct file_operations ab8540_gpadc_vbat_true_meas_and_ibat_fops = {
WARNING: line over 80 characters
+ vmain_l, vmain_h, btemp_l, btemp_h, vbat_l, vbat_h, ibat_l, ibat_h);
WARNING: quoted string split across lines
+ dev_err(dev, "debugfs error input: "
+ "should be egal to 1, 4, 8 or 16\n");
WARNING: Missing a blank line after declarations
+ char *s = b;
+ if ((*s == '0') && ((*(s+1) == 'x') || (*(s+1) == 'X'))) {
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.mask = simple_strtoul(b, &b, 0);
WARNING: simple_strtol is obsolete, use kstrtol instead
+ loc.shift = simple_strtol(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.bank = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.addr = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ val = simple_strtoul(b, &b, 0);
WARNING: quoted string split across lines
+ pr_warn("HWREG request: %s, %s, addr=0x%08X, mask=0x%X, shift=%d"
+ "value=0x%X\n", (write) ? "write" : "read",
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "sysfs_create_file failed %d\n", err);
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "request_threaded_irq failed %d, %lu\n",
ERROR: code indent should use tabs where possible
+ err, user_val);$
WARNING: please, no spaces at the start of a line
+ err, user_val);$
WARNING: Missing a blank line after declarations
+ struct resource *res;
+ debug_bank = AB8500_MISC;
ERROR: space required after that ',' (ctx:VxV)
+ sizeof(*dev_attr)*num_irqs,GFP_KERNEL);
^
WARNING: return of an errno should typically be -ve (return -ENXIO)
+ return ENXIO;
WARNING: line over 80 characters
+ file = debugfs_create_file("register-bank", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-address", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-value", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-subscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-unsubscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("all-modem-registers", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_v", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("usb_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("xtal_temp", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_xtal_temp_fops);
WARNING: line over 80 characters
+ file = debugfs_create_file("vbattruemeas", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("otp_calib", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_otp_calib_fops);
total: 2 errors, 44 warnings, 3230 lines checked
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-14 17:29:16 +00:00
|
|
|
dev_info(dev, " [0x%02X/0x%02X]: 0x%02X\n",
|
|
|
|
bank, reg, value);
|
2010-11-26 12:06:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-02-22 02:53:43 +00:00
|
|
|
|
2010-11-26 12:06:39 +00:00
|
|
|
return 0;
|
2010-09-13 14:05:04 +00:00
|
|
|
}
|
|
|
|
|
2017-12-14 10:51:21 +00:00
|
|
|
static int ab8500_bank_registers_show(struct seq_file *s, void *p)
|
2012-01-26 14:39:20 +00:00
|
|
|
{
|
|
|
|
struct device *dev = s->private;
|
|
|
|
u32 bank = debug_bank;
|
|
|
|
|
mfd: ab8500-debugfs: BIG clean-up
When checkpatch is run on ab8500-debugfs.c it screamed blue murder!
This patch fixes up all of the errors/warnings reported:
WARNING: line over 80 characters
+ err = seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO"ab8500 register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" bank 0x%02X:\n", i);
WARNING: externs should be avoided in .c files
+extern int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
WARNING: quoted string split across lines
+ pr_info("Saving all ABB registers at \"ab8500_complete_register_dump\" "
+ "for crash analyze.\n");
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "abx500_set_reg failed %d, %d", err, __LINE__);
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, "name: number: number of: wake:\n");
WARNING: line over 80 characters
+ return single_open(file, ab8500_print_modem_registers, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_btemp_ball_print, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_main_bat_v_print, inode->i_private);
WARNING: line over 80 characters
+ vbat_true_meas_convert = ab8500_gpadc_ad_to_voltage(gpadc, VBAT_TRUE_MEAS,
WARNING: line over 80 characters
+static int ab8540_gpadc_vbat_true_meas_and_ibat_print(struct seq_file *s, void *p)
WARNING: line over 80 characters
+static const struct file_operations ab8540_gpadc_vbat_true_meas_and_ibat_fops = {
WARNING: line over 80 characters
+ vmain_l, vmain_h, btemp_l, btemp_h, vbat_l, vbat_h, ibat_l, ibat_h);
WARNING: quoted string split across lines
+ dev_err(dev, "debugfs error input: "
+ "should be egal to 1, 4, 8 or 16\n");
WARNING: Missing a blank line after declarations
+ char *s = b;
+ if ((*s == '0') && ((*(s+1) == 'x') || (*(s+1) == 'X'))) {
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.mask = simple_strtoul(b, &b, 0);
WARNING: simple_strtol is obsolete, use kstrtol instead
+ loc.shift = simple_strtol(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.bank = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.addr = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ val = simple_strtoul(b, &b, 0);
WARNING: quoted string split across lines
+ pr_warn("HWREG request: %s, %s, addr=0x%08X, mask=0x%X, shift=%d"
+ "value=0x%X\n", (write) ? "write" : "read",
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "sysfs_create_file failed %d\n", err);
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "request_threaded_irq failed %d, %lu\n",
ERROR: code indent should use tabs where possible
+ err, user_val);$
WARNING: please, no spaces at the start of a line
+ err, user_val);$
WARNING: Missing a blank line after declarations
+ struct resource *res;
+ debug_bank = AB8500_MISC;
ERROR: space required after that ',' (ctx:VxV)
+ sizeof(*dev_attr)*num_irqs,GFP_KERNEL);
^
WARNING: return of an errno should typically be -ve (return -ENXIO)
+ return ENXIO;
WARNING: line over 80 characters
+ file = debugfs_create_file("register-bank", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-address", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-value", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-subscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-unsubscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("all-modem-registers", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_v", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("usb_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("xtal_temp", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_xtal_temp_fops);
WARNING: line over 80 characters
+ file = debugfs_create_file("vbattruemeas", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("otp_calib", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_otp_calib_fops);
total: 2 errors, 44 warnings, 3230 lines checked
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-14 17:29:16 +00:00
|
|
|
seq_puts(s, AB8500_NAME_STRING " register values:\n");
|
2012-01-26 14:39:20 +00:00
|
|
|
|
2012-05-28 13:53:58 +00:00
|
|
|
seq_printf(s, " bank 0x%02X:\n", bank);
|
2012-01-26 14:39:20 +00:00
|
|
|
|
2015-02-22 02:53:43 +00:00
|
|
|
return ab8500_registers_print(dev, bank, s);
|
2012-01-26 14:39:20 +00:00
|
|
|
}
|
|
|
|
|
2017-12-14 10:51:21 +00:00
|
|
|
DEFINE_SHOW_ATTRIBUTE(ab8500_bank_registers);
|
2010-09-13 14:05:04 +00:00
|
|
|
|
2012-01-26 14:39:20 +00:00
|
|
|
static int ab8500_print_all_banks(struct seq_file *s, void *p)
|
|
|
|
{
|
|
|
|
struct device *dev = s->private;
|
|
|
|
unsigned int i;
|
|
|
|
|
mfd: ab8500-debugfs: BIG clean-up
When checkpatch is run on ab8500-debugfs.c it screamed blue murder!
This patch fixes up all of the errors/warnings reported:
WARNING: line over 80 characters
+ err = seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO"ab8500 register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" bank 0x%02X:\n", i);
WARNING: externs should be avoided in .c files
+extern int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
WARNING: quoted string split across lines
+ pr_info("Saving all ABB registers at \"ab8500_complete_register_dump\" "
+ "for crash analyze.\n");
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "abx500_set_reg failed %d, %d", err, __LINE__);
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, "name: number: number of: wake:\n");
WARNING: line over 80 characters
+ return single_open(file, ab8500_print_modem_registers, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_btemp_ball_print, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_main_bat_v_print, inode->i_private);
WARNING: line over 80 characters
+ vbat_true_meas_convert = ab8500_gpadc_ad_to_voltage(gpadc, VBAT_TRUE_MEAS,
WARNING: line over 80 characters
+static int ab8540_gpadc_vbat_true_meas_and_ibat_print(struct seq_file *s, void *p)
WARNING: line over 80 characters
+static const struct file_operations ab8540_gpadc_vbat_true_meas_and_ibat_fops = {
WARNING: line over 80 characters
+ vmain_l, vmain_h, btemp_l, btemp_h, vbat_l, vbat_h, ibat_l, ibat_h);
WARNING: quoted string split across lines
+ dev_err(dev, "debugfs error input: "
+ "should be egal to 1, 4, 8 or 16\n");
WARNING: Missing a blank line after declarations
+ char *s = b;
+ if ((*s == '0') && ((*(s+1) == 'x') || (*(s+1) == 'X'))) {
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.mask = simple_strtoul(b, &b, 0);
WARNING: simple_strtol is obsolete, use kstrtol instead
+ loc.shift = simple_strtol(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.bank = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.addr = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ val = simple_strtoul(b, &b, 0);
WARNING: quoted string split across lines
+ pr_warn("HWREG request: %s, %s, addr=0x%08X, mask=0x%X, shift=%d"
+ "value=0x%X\n", (write) ? "write" : "read",
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "sysfs_create_file failed %d\n", err);
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "request_threaded_irq failed %d, %lu\n",
ERROR: code indent should use tabs where possible
+ err, user_val);$
WARNING: please, no spaces at the start of a line
+ err, user_val);$
WARNING: Missing a blank line after declarations
+ struct resource *res;
+ debug_bank = AB8500_MISC;
ERROR: space required after that ',' (ctx:VxV)
+ sizeof(*dev_attr)*num_irqs,GFP_KERNEL);
^
WARNING: return of an errno should typically be -ve (return -ENXIO)
+ return ENXIO;
WARNING: line over 80 characters
+ file = debugfs_create_file("register-bank", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-address", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-value", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-subscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-unsubscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("all-modem-registers", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_v", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("usb_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("xtal_temp", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_xtal_temp_fops);
WARNING: line over 80 characters
+ file = debugfs_create_file("vbattruemeas", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("otp_calib", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_otp_calib_fops);
total: 2 errors, 44 warnings, 3230 lines checked
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-14 17:29:16 +00:00
|
|
|
seq_puts(s, AB8500_NAME_STRING " register values:\n");
|
2012-01-26 14:39:20 +00:00
|
|
|
|
2012-11-19 11:20:03 +00:00
|
|
|
for (i = 0; i < AB8500_NUM_BANKS; i++) {
|
2015-02-22 02:53:43 +00:00
|
|
|
int err;
|
2012-01-26 14:39:20 +00:00
|
|
|
|
2015-02-22 02:53:43 +00:00
|
|
|
seq_printf(s, " bank 0x%02X:\n", i);
|
|
|
|
err = ab8500_registers_print(dev, i, s);
|
|
|
|
if (err)
|
|
|
|
return err;
|
2012-01-26 14:39:20 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-01-27 10:35:41 +00:00
|
|
|
/* Dump registers to kernel log */
|
|
|
|
void ab8500_dump_all_banks(struct device *dev)
|
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
|
mfd: ab8500-debugfs: BIG clean-up
When checkpatch is run on ab8500-debugfs.c it screamed blue murder!
This patch fixes up all of the errors/warnings reported:
WARNING: line over 80 characters
+ err = seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO"ab8500 register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" bank 0x%02X:\n", i);
WARNING: externs should be avoided in .c files
+extern int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
WARNING: quoted string split across lines
+ pr_info("Saving all ABB registers at \"ab8500_complete_register_dump\" "
+ "for crash analyze.\n");
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "abx500_set_reg failed %d, %d", err, __LINE__);
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, "name: number: number of: wake:\n");
WARNING: line over 80 characters
+ return single_open(file, ab8500_print_modem_registers, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_btemp_ball_print, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_main_bat_v_print, inode->i_private);
WARNING: line over 80 characters
+ vbat_true_meas_convert = ab8500_gpadc_ad_to_voltage(gpadc, VBAT_TRUE_MEAS,
WARNING: line over 80 characters
+static int ab8540_gpadc_vbat_true_meas_and_ibat_print(struct seq_file *s, void *p)
WARNING: line over 80 characters
+static const struct file_operations ab8540_gpadc_vbat_true_meas_and_ibat_fops = {
WARNING: line over 80 characters
+ vmain_l, vmain_h, btemp_l, btemp_h, vbat_l, vbat_h, ibat_l, ibat_h);
WARNING: quoted string split across lines
+ dev_err(dev, "debugfs error input: "
+ "should be egal to 1, 4, 8 or 16\n");
WARNING: Missing a blank line after declarations
+ char *s = b;
+ if ((*s == '0') && ((*(s+1) == 'x') || (*(s+1) == 'X'))) {
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.mask = simple_strtoul(b, &b, 0);
WARNING: simple_strtol is obsolete, use kstrtol instead
+ loc.shift = simple_strtol(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.bank = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.addr = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ val = simple_strtoul(b, &b, 0);
WARNING: quoted string split across lines
+ pr_warn("HWREG request: %s, %s, addr=0x%08X, mask=0x%X, shift=%d"
+ "value=0x%X\n", (write) ? "write" : "read",
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "sysfs_create_file failed %d\n", err);
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "request_threaded_irq failed %d, %lu\n",
ERROR: code indent should use tabs where possible
+ err, user_val);$
WARNING: please, no spaces at the start of a line
+ err, user_val);$
WARNING: Missing a blank line after declarations
+ struct resource *res;
+ debug_bank = AB8500_MISC;
ERROR: space required after that ',' (ctx:VxV)
+ sizeof(*dev_attr)*num_irqs,GFP_KERNEL);
^
WARNING: return of an errno should typically be -ve (return -ENXIO)
+ return ENXIO;
WARNING: line over 80 characters
+ file = debugfs_create_file("register-bank", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-address", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-value", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-subscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-unsubscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("all-modem-registers", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_v", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("usb_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("xtal_temp", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_xtal_temp_fops);
WARNING: line over 80 characters
+ file = debugfs_create_file("vbattruemeas", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("otp_calib", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_otp_calib_fops);
total: 2 errors, 44 warnings, 3230 lines checked
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-14 17:29:16 +00:00
|
|
|
dev_info(dev, "ab8500 register values:\n");
|
2012-01-27 10:35:41 +00:00
|
|
|
|
|
|
|
for (i = 1; i < AB8500_NUM_BANKS; i++) {
|
mfd: ab8500-debugfs: BIG clean-up
When checkpatch is run on ab8500-debugfs.c it screamed blue murder!
This patch fixes up all of the errors/warnings reported:
WARNING: line over 80 characters
+ err = seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO"ab8500 register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" bank 0x%02X:\n", i);
WARNING: externs should be avoided in .c files
+extern int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
WARNING: quoted string split across lines
+ pr_info("Saving all ABB registers at \"ab8500_complete_register_dump\" "
+ "for crash analyze.\n");
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "abx500_set_reg failed %d, %d", err, __LINE__);
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, "name: number: number of: wake:\n");
WARNING: line over 80 characters
+ return single_open(file, ab8500_print_modem_registers, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_btemp_ball_print, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_main_bat_v_print, inode->i_private);
WARNING: line over 80 characters
+ vbat_true_meas_convert = ab8500_gpadc_ad_to_voltage(gpadc, VBAT_TRUE_MEAS,
WARNING: line over 80 characters
+static int ab8540_gpadc_vbat_true_meas_and_ibat_print(struct seq_file *s, void *p)
WARNING: line over 80 characters
+static const struct file_operations ab8540_gpadc_vbat_true_meas_and_ibat_fops = {
WARNING: line over 80 characters
+ vmain_l, vmain_h, btemp_l, btemp_h, vbat_l, vbat_h, ibat_l, ibat_h);
WARNING: quoted string split across lines
+ dev_err(dev, "debugfs error input: "
+ "should be egal to 1, 4, 8 or 16\n");
WARNING: Missing a blank line after declarations
+ char *s = b;
+ if ((*s == '0') && ((*(s+1) == 'x') || (*(s+1) == 'X'))) {
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.mask = simple_strtoul(b, &b, 0);
WARNING: simple_strtol is obsolete, use kstrtol instead
+ loc.shift = simple_strtol(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.bank = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.addr = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ val = simple_strtoul(b, &b, 0);
WARNING: quoted string split across lines
+ pr_warn("HWREG request: %s, %s, addr=0x%08X, mask=0x%X, shift=%d"
+ "value=0x%X\n", (write) ? "write" : "read",
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "sysfs_create_file failed %d\n", err);
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "request_threaded_irq failed %d, %lu\n",
ERROR: code indent should use tabs where possible
+ err, user_val);$
WARNING: please, no spaces at the start of a line
+ err, user_val);$
WARNING: Missing a blank line after declarations
+ struct resource *res;
+ debug_bank = AB8500_MISC;
ERROR: space required after that ',' (ctx:VxV)
+ sizeof(*dev_attr)*num_irqs,GFP_KERNEL);
^
WARNING: return of an errno should typically be -ve (return -ENXIO)
+ return ENXIO;
WARNING: line over 80 characters
+ file = debugfs_create_file("register-bank", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-address", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-value", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-subscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-unsubscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("all-modem-registers", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_v", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("usb_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("xtal_temp", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_xtal_temp_fops);
WARNING: line over 80 characters
+ file = debugfs_create_file("vbattruemeas", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("otp_calib", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_otp_calib_fops);
total: 2 errors, 44 warnings, 3230 lines checked
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-14 17:29:16 +00:00
|
|
|
dev_info(dev, " bank 0x%02X:\n", i);
|
2012-01-27 10:35:41 +00:00
|
|
|
ab8500_registers_print(dev, i, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-26 14:39:20 +00:00
|
|
|
static int ab8500_all_banks_open(struct inode *inode, struct file *file)
|
|
|
|
{
|
|
|
|
struct seq_file *s;
|
|
|
|
int err;
|
|
|
|
|
|
|
|
err = single_open(file, ab8500_print_all_banks, inode->i_private);
|
|
|
|
if (!err) {
|
|
|
|
/* Default buf size in seq_read is not enough */
|
|
|
|
s = (struct seq_file *)file->private_data;
|
|
|
|
s->size = (PAGE_SIZE * 2);
|
|
|
|
s->buf = kmalloc(s->size, GFP_KERNEL);
|
|
|
|
if (!s->buf) {
|
|
|
|
single_release(inode, file);
|
|
|
|
err = -ENOMEM;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct file_operations ab8500_all_banks_fops = {
|
|
|
|
.open = ab8500_all_banks_open,
|
|
|
|
.read = seq_read,
|
|
|
|
.llseek = seq_lseek,
|
|
|
|
.release = single_release,
|
|
|
|
.owner = THIS_MODULE,
|
|
|
|
};
|
|
|
|
|
2010-09-13 14:05:04 +00:00
|
|
|
static int ab8500_bank_print(struct seq_file *s, void *p)
|
|
|
|
{
|
2015-02-22 02:53:43 +00:00
|
|
|
seq_printf(s, "0x%02X\n", debug_bank);
|
|
|
|
return 0;
|
2010-09-13 14:05:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int ab8500_bank_open(struct inode *inode, struct file *file)
|
|
|
|
{
|
2010-11-26 12:06:39 +00:00
|
|
|
return single_open(file, ab8500_bank_print, inode->i_private);
|
2010-09-13 14:05:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ssize_t ab8500_bank_write(struct file *file,
|
2010-11-26 12:06:39 +00:00
|
|
|
const char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos)
|
2010-09-13 14:05:04 +00:00
|
|
|
{
|
2010-11-26 12:06:39 +00:00
|
|
|
struct device *dev = ((struct seq_file *)(file->private_data))->private;
|
|
|
|
unsigned long user_bank;
|
|
|
|
int err;
|
|
|
|
|
2011-06-06 20:43:32 +00:00
|
|
|
err = kstrtoul_from_user(user_buf, count, 0, &user_bank);
|
2010-11-26 12:06:39 +00:00
|
|
|
if (err)
|
2011-06-06 20:43:32 +00:00
|
|
|
return err;
|
2010-11-26 12:06:39 +00:00
|
|
|
|
|
|
|
if (user_bank >= AB8500_NUM_BANKS) {
|
|
|
|
dev_err(dev, "debugfs error input > number of banks\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
debug_bank = user_bank;
|
|
|
|
|
2011-06-06 20:43:32 +00:00
|
|
|
return count;
|
2010-09-13 14:05:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int ab8500_address_print(struct seq_file *s, void *p)
|
|
|
|
{
|
2015-02-22 02:53:43 +00:00
|
|
|
seq_printf(s, "0x%02X\n", debug_address);
|
|
|
|
return 0;
|
2010-09-13 14:05:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int ab8500_address_open(struct inode *inode, struct file *file)
|
|
|
|
{
|
2010-11-26 12:06:39 +00:00
|
|
|
return single_open(file, ab8500_address_print, inode->i_private);
|
2010-09-13 14:05:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ssize_t ab8500_address_write(struct file *file,
|
2013-02-26 12:05:15 +00:00
|
|
|
const char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos)
|
2010-09-13 14:05:04 +00:00
|
|
|
{
|
2010-11-26 12:06:39 +00:00
|
|
|
struct device *dev = ((struct seq_file *)(file->private_data))->private;
|
|
|
|
unsigned long user_address;
|
|
|
|
int err;
|
|
|
|
|
2011-06-06 20:43:32 +00:00
|
|
|
err = kstrtoul_from_user(user_buf, count, 0, &user_address);
|
2010-11-26 12:06:39 +00:00
|
|
|
if (err)
|
2011-06-06 20:43:32 +00:00
|
|
|
return err;
|
|
|
|
|
2010-11-26 12:06:39 +00:00
|
|
|
if (user_address > 0xff) {
|
|
|
|
dev_err(dev, "debugfs error input > 0xff\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
debug_address = user_address;
|
2012-11-23 09:41:00 +00:00
|
|
|
|
2011-06-06 20:43:32 +00:00
|
|
|
return count;
|
2010-09-13 14:05:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int ab8500_val_print(struct seq_file *s, void *p)
|
|
|
|
{
|
2010-11-26 12:06:39 +00:00
|
|
|
struct device *dev = s->private;
|
|
|
|
int ret;
|
|
|
|
u8 regvalue;
|
|
|
|
|
|
|
|
ret = abx500_get_register_interruptible(dev,
|
|
|
|
(u8)debug_bank, (u8)debug_address, ®value);
|
|
|
|
if (ret < 0) {
|
|
|
|
dev_err(dev, "abx500_get_reg fail %d, %d\n",
|
|
|
|
ret, __LINE__);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
seq_printf(s, "0x%02X\n", regvalue);
|
|
|
|
|
|
|
|
return 0;
|
2010-09-13 14:05:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int ab8500_val_open(struct inode *inode, struct file *file)
|
|
|
|
{
|
2010-11-26 12:06:39 +00:00
|
|
|
return single_open(file, ab8500_val_print, inode->i_private);
|
2010-09-13 14:05:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ssize_t ab8500_val_write(struct file *file,
|
2013-02-26 12:05:15 +00:00
|
|
|
const char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos)
|
2010-09-13 14:05:04 +00:00
|
|
|
{
|
2010-11-26 12:06:39 +00:00
|
|
|
struct device *dev = ((struct seq_file *)(file->private_data))->private;
|
|
|
|
unsigned long user_val;
|
|
|
|
int err;
|
|
|
|
|
2011-06-06 20:43:32 +00:00
|
|
|
err = kstrtoul_from_user(user_buf, count, 0, &user_val);
|
2010-11-26 12:06:39 +00:00
|
|
|
if (err)
|
2011-06-06 20:43:32 +00:00
|
|
|
return err;
|
|
|
|
|
2010-11-26 12:06:39 +00:00
|
|
|
if (user_val > 0xff) {
|
|
|
|
dev_err(dev, "debugfs error input > 0xff\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
err = abx500_set_register_interruptible(dev,
|
|
|
|
(u8)debug_bank, debug_address, (u8)user_val);
|
|
|
|
if (err < 0) {
|
mfd: ab8500-debugfs: BIG clean-up
When checkpatch is run on ab8500-debugfs.c it screamed blue murder!
This patch fixes up all of the errors/warnings reported:
WARNING: line over 80 characters
+ err = seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO"ab8500 register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" bank 0x%02X:\n", i);
WARNING: externs should be avoided in .c files
+extern int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
WARNING: quoted string split across lines
+ pr_info("Saving all ABB registers at \"ab8500_complete_register_dump\" "
+ "for crash analyze.\n");
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "abx500_set_reg failed %d, %d", err, __LINE__);
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, "name: number: number of: wake:\n");
WARNING: line over 80 characters
+ return single_open(file, ab8500_print_modem_registers, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_btemp_ball_print, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_main_bat_v_print, inode->i_private);
WARNING: line over 80 characters
+ vbat_true_meas_convert = ab8500_gpadc_ad_to_voltage(gpadc, VBAT_TRUE_MEAS,
WARNING: line over 80 characters
+static int ab8540_gpadc_vbat_true_meas_and_ibat_print(struct seq_file *s, void *p)
WARNING: line over 80 characters
+static const struct file_operations ab8540_gpadc_vbat_true_meas_and_ibat_fops = {
WARNING: line over 80 characters
+ vmain_l, vmain_h, btemp_l, btemp_h, vbat_l, vbat_h, ibat_l, ibat_h);
WARNING: quoted string split across lines
+ dev_err(dev, "debugfs error input: "
+ "should be egal to 1, 4, 8 or 16\n");
WARNING: Missing a blank line after declarations
+ char *s = b;
+ if ((*s == '0') && ((*(s+1) == 'x') || (*(s+1) == 'X'))) {
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.mask = simple_strtoul(b, &b, 0);
WARNING: simple_strtol is obsolete, use kstrtol instead
+ loc.shift = simple_strtol(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.bank = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.addr = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ val = simple_strtoul(b, &b, 0);
WARNING: quoted string split across lines
+ pr_warn("HWREG request: %s, %s, addr=0x%08X, mask=0x%X, shift=%d"
+ "value=0x%X\n", (write) ? "write" : "read",
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "sysfs_create_file failed %d\n", err);
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "request_threaded_irq failed %d, %lu\n",
ERROR: code indent should use tabs where possible
+ err, user_val);$
WARNING: please, no spaces at the start of a line
+ err, user_val);$
WARNING: Missing a blank line after declarations
+ struct resource *res;
+ debug_bank = AB8500_MISC;
ERROR: space required after that ',' (ctx:VxV)
+ sizeof(*dev_attr)*num_irqs,GFP_KERNEL);
^
WARNING: return of an errno should typically be -ve (return -ENXIO)
+ return ENXIO;
WARNING: line over 80 characters
+ file = debugfs_create_file("register-bank", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-address", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-value", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-subscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-unsubscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("all-modem-registers", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_v", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("usb_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("xtal_temp", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_xtal_temp_fops);
WARNING: line over 80 characters
+ file = debugfs_create_file("vbattruemeas", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("otp_calib", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_otp_calib_fops);
total: 2 errors, 44 warnings, 3230 lines checked
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-14 17:29:16 +00:00
|
|
|
pr_err("abx500_set_reg failed %d, %d", err, __LINE__);
|
2010-11-26 12:06:39 +00:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2011-06-06 20:43:32 +00:00
|
|
|
return count;
|
2010-09-13 14:05:04 +00:00
|
|
|
}
|
|
|
|
|
2012-02-14 12:01:00 +00:00
|
|
|
/*
|
|
|
|
* Interrupt status
|
|
|
|
*/
|
|
|
|
static u32 num_interrupts[AB8500_MAX_NR_IRQS];
|
2012-05-31 05:57:07 +00:00
|
|
|
static u32 num_wake_interrupts[AB8500_MAX_NR_IRQS];
|
2012-02-14 12:01:00 +00:00
|
|
|
static int num_interrupt_lines;
|
|
|
|
|
|
|
|
void ab8500_debug_register_interrupt(int line)
|
|
|
|
{
|
2016-09-14 10:56:34 +00:00
|
|
|
if (line < num_interrupt_lines)
|
2012-02-14 12:01:00 +00:00
|
|
|
num_interrupts[line]++;
|
|
|
|
}
|
|
|
|
|
2017-12-14 10:51:21 +00:00
|
|
|
static int ab8500_interrupts_show(struct seq_file *s, void *p)
|
2012-02-14 12:01:00 +00:00
|
|
|
{
|
|
|
|
int line;
|
|
|
|
|
mfd: ab8500-debugfs: BIG clean-up
When checkpatch is run on ab8500-debugfs.c it screamed blue murder!
This patch fixes up all of the errors/warnings reported:
WARNING: line over 80 characters
+ err = seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO"ab8500 register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" bank 0x%02X:\n", i);
WARNING: externs should be avoided in .c files
+extern int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
WARNING: quoted string split across lines
+ pr_info("Saving all ABB registers at \"ab8500_complete_register_dump\" "
+ "for crash analyze.\n");
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "abx500_set_reg failed %d, %d", err, __LINE__);
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, "name: number: number of: wake:\n");
WARNING: line over 80 characters
+ return single_open(file, ab8500_print_modem_registers, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_btemp_ball_print, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_main_bat_v_print, inode->i_private);
WARNING: line over 80 characters
+ vbat_true_meas_convert = ab8500_gpadc_ad_to_voltage(gpadc, VBAT_TRUE_MEAS,
WARNING: line over 80 characters
+static int ab8540_gpadc_vbat_true_meas_and_ibat_print(struct seq_file *s, void *p)
WARNING: line over 80 characters
+static const struct file_operations ab8540_gpadc_vbat_true_meas_and_ibat_fops = {
WARNING: line over 80 characters
+ vmain_l, vmain_h, btemp_l, btemp_h, vbat_l, vbat_h, ibat_l, ibat_h);
WARNING: quoted string split across lines
+ dev_err(dev, "debugfs error input: "
+ "should be egal to 1, 4, 8 or 16\n");
WARNING: Missing a blank line after declarations
+ char *s = b;
+ if ((*s == '0') && ((*(s+1) == 'x') || (*(s+1) == 'X'))) {
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.mask = simple_strtoul(b, &b, 0);
WARNING: simple_strtol is obsolete, use kstrtol instead
+ loc.shift = simple_strtol(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.bank = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.addr = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ val = simple_strtoul(b, &b, 0);
WARNING: quoted string split across lines
+ pr_warn("HWREG request: %s, %s, addr=0x%08X, mask=0x%X, shift=%d"
+ "value=0x%X\n", (write) ? "write" : "read",
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "sysfs_create_file failed %d\n", err);
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "request_threaded_irq failed %d, %lu\n",
ERROR: code indent should use tabs where possible
+ err, user_val);$
WARNING: please, no spaces at the start of a line
+ err, user_val);$
WARNING: Missing a blank line after declarations
+ struct resource *res;
+ debug_bank = AB8500_MISC;
ERROR: space required after that ',' (ctx:VxV)
+ sizeof(*dev_attr)*num_irqs,GFP_KERNEL);
^
WARNING: return of an errno should typically be -ve (return -ENXIO)
+ return ENXIO;
WARNING: line over 80 characters
+ file = debugfs_create_file("register-bank", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-address", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-value", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-subscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-unsubscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("all-modem-registers", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_v", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("usb_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("xtal_temp", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_xtal_temp_fops);
WARNING: line over 80 characters
+ file = debugfs_create_file("vbattruemeas", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("otp_calib", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_otp_calib_fops);
total: 2 errors, 44 warnings, 3230 lines checked
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-14 17:29:16 +00:00
|
|
|
seq_puts(s, "name: number: number of: wake:\n");
|
2012-05-31 05:57:07 +00:00
|
|
|
|
|
|
|
for (line = 0; line < num_interrupt_lines; line++) {
|
|
|
|
struct irq_desc *desc = irq_to_desc(line + irq_first);
|
2012-02-14 12:01:00 +00:00
|
|
|
|
2015-02-22 02:53:43 +00:00
|
|
|
seq_printf(s, "%3i: %6i %4i",
|
|
|
|
line,
|
2012-05-31 05:57:07 +00:00
|
|
|
num_interrupts[line],
|
|
|
|
num_wake_interrupts[line]);
|
|
|
|
|
|
|
|
if (desc && desc->name)
|
|
|
|
seq_printf(s, "-%-8s", desc->name);
|
2013-11-13 07:40:30 +00:00
|
|
|
if (desc && desc->action) {
|
|
|
|
struct irqaction *action = desc->action;
|
|
|
|
|
2012-05-31 05:57:07 +00:00
|
|
|
seq_printf(s, " %s", action->name);
|
|
|
|
while ((action = action->next) != NULL)
|
|
|
|
seq_printf(s, ", %s", action->name);
|
|
|
|
}
|
|
|
|
seq_putc(s, '\n');
|
|
|
|
}
|
2012-02-14 12:01:00 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-12-14 10:51:21 +00:00
|
|
|
DEFINE_SHOW_ATTRIBUTE(ab8500_interrupts);
|
2012-02-14 12:01:00 +00:00
|
|
|
|
2011-04-08 14:26:36 +00:00
|
|
|
/*
|
|
|
|
* - HWREG DB8500 formated routines
|
|
|
|
*/
|
|
|
|
static int ab8500_hwreg_print(struct seq_file *s, void *d)
|
|
|
|
{
|
|
|
|
struct device *dev = s->private;
|
|
|
|
int ret;
|
|
|
|
u8 regvalue;
|
|
|
|
|
|
|
|
ret = abx500_get_register_interruptible(dev,
|
|
|
|
(u8)hwreg_cfg.bank, (u8)hwreg_cfg.addr, ®value);
|
|
|
|
if (ret < 0) {
|
|
|
|
dev_err(dev, "abx500_get_reg fail %d, %d\n",
|
|
|
|
ret, __LINE__);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hwreg_cfg.shift >= 0)
|
|
|
|
regvalue >>= hwreg_cfg.shift;
|
|
|
|
else
|
|
|
|
regvalue <<= -hwreg_cfg.shift;
|
|
|
|
regvalue &= hwreg_cfg.mask;
|
|
|
|
|
|
|
|
if (REG_FMT_DEC(&hwreg_cfg))
|
|
|
|
seq_printf(s, "%d\n", regvalue);
|
|
|
|
else
|
|
|
|
seq_printf(s, "0x%02X\n", regvalue);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ab8500_hwreg_open(struct inode *inode, struct file *file)
|
|
|
|
{
|
|
|
|
return single_open(file, ab8500_hwreg_print, inode->i_private);
|
|
|
|
}
|
|
|
|
|
2013-02-26 14:03:33 +00:00
|
|
|
#define AB8500_SUPPLY_CONTROL_CONFIG_1 0x01
|
|
|
|
#define AB8500_SUPPLY_CONTROL_REG 0x00
|
|
|
|
#define AB8500_FIRST_SIM_REG 0x80
|
|
|
|
#define AB8500_LAST_SIM_REG 0x8B
|
|
|
|
#define AB8505_LAST_SIM_REG 0x8C
|
|
|
|
|
2017-12-14 10:51:21 +00:00
|
|
|
static int ab8500_modem_show(struct seq_file *s, void *p)
|
2013-02-26 14:03:33 +00:00
|
|
|
{
|
|
|
|
struct device *dev = s->private;
|
|
|
|
struct ab8500 *ab8500;
|
|
|
|
int err;
|
|
|
|
u8 value;
|
|
|
|
u8 orig_value;
|
|
|
|
u32 bank = AB8500_REGU_CTRL2;
|
|
|
|
u32 last_sim_reg = AB8500_LAST_SIM_REG;
|
|
|
|
u32 reg;
|
|
|
|
|
|
|
|
ab8500 = dev_get_drvdata(dev->parent);
|
|
|
|
dev_warn(dev, "WARNING! This operation can interfer with modem side\n"
|
|
|
|
"and should only be done with care\n");
|
|
|
|
|
|
|
|
err = abx500_get_register_interruptible(dev,
|
|
|
|
AB8500_REGU_CTRL1, AB8500_SUPPLY_CONTROL_REG, &orig_value);
|
2017-10-27 15:20:45 +00:00
|
|
|
if (err < 0)
|
|
|
|
goto report_read_failure;
|
|
|
|
|
2013-02-26 14:03:33 +00:00
|
|
|
/* Config 1 will allow APE side to read SIM registers */
|
|
|
|
err = abx500_set_register_interruptible(dev,
|
|
|
|
AB8500_REGU_CTRL1, AB8500_SUPPLY_CONTROL_REG,
|
|
|
|
AB8500_SUPPLY_CONTROL_CONFIG_1);
|
2017-10-27 15:20:45 +00:00
|
|
|
if (err < 0)
|
|
|
|
goto report_write_failure;
|
2013-02-26 14:03:33 +00:00
|
|
|
|
|
|
|
seq_printf(s, " bank 0x%02X:\n", bank);
|
|
|
|
|
|
|
|
if (is_ab9540(ab8500) || is_ab8505(ab8500))
|
|
|
|
last_sim_reg = AB8505_LAST_SIM_REG;
|
|
|
|
|
|
|
|
for (reg = AB8500_FIRST_SIM_REG; reg <= last_sim_reg; reg++) {
|
|
|
|
err = abx500_get_register_interruptible(dev,
|
|
|
|
bank, reg, &value);
|
2017-10-27 15:20:45 +00:00
|
|
|
if (err < 0)
|
|
|
|
goto report_read_failure;
|
|
|
|
|
2015-02-22 02:53:43 +00:00
|
|
|
seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n", bank, reg, value);
|
2013-02-26 14:03:33 +00:00
|
|
|
}
|
|
|
|
err = abx500_set_register_interruptible(dev,
|
|
|
|
AB8500_REGU_CTRL1, AB8500_SUPPLY_CONTROL_REG, orig_value);
|
2017-10-27 15:20:45 +00:00
|
|
|
if (err < 0)
|
|
|
|
goto report_write_failure;
|
|
|
|
|
2013-02-26 14:03:33 +00:00
|
|
|
return 0;
|
2017-10-27 15:20:45 +00:00
|
|
|
|
|
|
|
report_read_failure:
|
|
|
|
dev_err(dev, "ab->read fail %d\n", err);
|
|
|
|
return err;
|
|
|
|
|
|
|
|
report_write_failure:
|
|
|
|
dev_err(dev, "ab->write fail %d\n", err);
|
|
|
|
return err;
|
2013-02-26 14:03:33 +00:00
|
|
|
}
|
|
|
|
|
2017-12-14 10:51:21 +00:00
|
|
|
DEFINE_SHOW_ATTRIBUTE(ab8500_modem);
|
2013-02-26 14:03:33 +00:00
|
|
|
|
2011-04-08 14:26:36 +00:00
|
|
|
/*
|
|
|
|
* return length of an ASCII numerical value, 0 is string is not a
|
|
|
|
* numerical value.
|
|
|
|
* string shall start at value 1st char.
|
|
|
|
* string can be tailed with \0 or space or newline chars only.
|
|
|
|
* value can be decimal or hexadecimal (prefixed 0x or 0X).
|
|
|
|
*/
|
|
|
|
static int strval_len(char *b)
|
|
|
|
{
|
|
|
|
char *s = b;
|
mfd: ab8500-debugfs: BIG clean-up
When checkpatch is run on ab8500-debugfs.c it screamed blue murder!
This patch fixes up all of the errors/warnings reported:
WARNING: line over 80 characters
+ err = seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO"ab8500 register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" bank 0x%02X:\n", i);
WARNING: externs should be avoided in .c files
+extern int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
WARNING: quoted string split across lines
+ pr_info("Saving all ABB registers at \"ab8500_complete_register_dump\" "
+ "for crash analyze.\n");
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "abx500_set_reg failed %d, %d", err, __LINE__);
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, "name: number: number of: wake:\n");
WARNING: line over 80 characters
+ return single_open(file, ab8500_print_modem_registers, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_btemp_ball_print, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_main_bat_v_print, inode->i_private);
WARNING: line over 80 characters
+ vbat_true_meas_convert = ab8500_gpadc_ad_to_voltage(gpadc, VBAT_TRUE_MEAS,
WARNING: line over 80 characters
+static int ab8540_gpadc_vbat_true_meas_and_ibat_print(struct seq_file *s, void *p)
WARNING: line over 80 characters
+static const struct file_operations ab8540_gpadc_vbat_true_meas_and_ibat_fops = {
WARNING: line over 80 characters
+ vmain_l, vmain_h, btemp_l, btemp_h, vbat_l, vbat_h, ibat_l, ibat_h);
WARNING: quoted string split across lines
+ dev_err(dev, "debugfs error input: "
+ "should be egal to 1, 4, 8 or 16\n");
WARNING: Missing a blank line after declarations
+ char *s = b;
+ if ((*s == '0') && ((*(s+1) == 'x') || (*(s+1) == 'X'))) {
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.mask = simple_strtoul(b, &b, 0);
WARNING: simple_strtol is obsolete, use kstrtol instead
+ loc.shift = simple_strtol(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.bank = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.addr = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ val = simple_strtoul(b, &b, 0);
WARNING: quoted string split across lines
+ pr_warn("HWREG request: %s, %s, addr=0x%08X, mask=0x%X, shift=%d"
+ "value=0x%X\n", (write) ? "write" : "read",
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "sysfs_create_file failed %d\n", err);
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "request_threaded_irq failed %d, %lu\n",
ERROR: code indent should use tabs where possible
+ err, user_val);$
WARNING: please, no spaces at the start of a line
+ err, user_val);$
WARNING: Missing a blank line after declarations
+ struct resource *res;
+ debug_bank = AB8500_MISC;
ERROR: space required after that ',' (ctx:VxV)
+ sizeof(*dev_attr)*num_irqs,GFP_KERNEL);
^
WARNING: return of an errno should typically be -ve (return -ENXIO)
+ return ENXIO;
WARNING: line over 80 characters
+ file = debugfs_create_file("register-bank", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-address", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-value", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-subscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-unsubscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("all-modem-registers", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_v", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("usb_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("xtal_temp", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_xtal_temp_fops);
WARNING: line over 80 characters
+ file = debugfs_create_file("vbattruemeas", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("otp_calib", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_otp_calib_fops);
total: 2 errors, 44 warnings, 3230 lines checked
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-14 17:29:16 +00:00
|
|
|
|
2011-04-08 14:26:36 +00:00
|
|
|
if ((*s == '0') && ((*(s+1) == 'x') || (*(s+1) == 'X'))) {
|
|
|
|
s += 2;
|
|
|
|
for (; *s && (*s != ' ') && (*s != '\n'); s++) {
|
|
|
|
if (!isxdigit(*s))
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (*s == '-')
|
|
|
|
s++;
|
|
|
|
for (; *s && (*s != ' ') && (*s != '\n'); s++) {
|
|
|
|
if (!isdigit(*s))
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return (int) (s-b);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* parse hwreg input data.
|
|
|
|
* update global hwreg_cfg only if input data syntax is ok.
|
|
|
|
*/
|
|
|
|
static ssize_t hwreg_common_write(char *b, struct hwreg_cfg *cfg,
|
|
|
|
struct device *dev)
|
|
|
|
{
|
|
|
|
uint write, val = 0;
|
|
|
|
u8 regvalue;
|
|
|
|
int ret;
|
|
|
|
struct hwreg_cfg loc = {
|
|
|
|
.bank = 0, /* default: invalid phys addr */
|
|
|
|
.addr = 0, /* default: invalid phys addr */
|
|
|
|
.fmt = 0, /* default: 32bit access, hex output */
|
|
|
|
.mask = 0xFFFFFFFF, /* default: no mask */
|
|
|
|
.shift = 0, /* default: no bit shift */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* read or write ? */
|
|
|
|
if (!strncmp(b, "read ", 5)) {
|
|
|
|
write = 0;
|
|
|
|
b += 5;
|
|
|
|
} else if (!strncmp(b, "write ", 6)) {
|
|
|
|
write = 1;
|
|
|
|
b += 6;
|
|
|
|
} else
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
/* OPTIONS -l|-w|-b -s -m -o */
|
|
|
|
while ((*b == ' ') || (*b == '-')) {
|
|
|
|
if (*(b-1) != ' ') {
|
|
|
|
b++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if ((!strncmp(b, "-d ", 3)) ||
|
|
|
|
(!strncmp(b, "-dec ", 5))) {
|
|
|
|
b += (*(b+2) == ' ') ? 3 : 5;
|
|
|
|
loc.fmt |= (1<<0);
|
|
|
|
} else if ((!strncmp(b, "-h ", 3)) ||
|
|
|
|
(!strncmp(b, "-hex ", 5))) {
|
|
|
|
b += (*(b+2) == ' ') ? 3 : 5;
|
|
|
|
loc.fmt &= ~(1<<0);
|
|
|
|
} else if ((!strncmp(b, "-m ", 3)) ||
|
|
|
|
(!strncmp(b, "-mask ", 6))) {
|
|
|
|
b += (*(b+2) == ' ') ? 3 : 6;
|
|
|
|
if (strval_len(b) == 0)
|
|
|
|
return -EINVAL;
|
mfd: ab8500-debugfs: BIG clean-up
When checkpatch is run on ab8500-debugfs.c it screamed blue murder!
This patch fixes up all of the errors/warnings reported:
WARNING: line over 80 characters
+ err = seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO"ab8500 register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" bank 0x%02X:\n", i);
WARNING: externs should be avoided in .c files
+extern int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
WARNING: quoted string split across lines
+ pr_info("Saving all ABB registers at \"ab8500_complete_register_dump\" "
+ "for crash analyze.\n");
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "abx500_set_reg failed %d, %d", err, __LINE__);
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, "name: number: number of: wake:\n");
WARNING: line over 80 characters
+ return single_open(file, ab8500_print_modem_registers, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_btemp_ball_print, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_main_bat_v_print, inode->i_private);
WARNING: line over 80 characters
+ vbat_true_meas_convert = ab8500_gpadc_ad_to_voltage(gpadc, VBAT_TRUE_MEAS,
WARNING: line over 80 characters
+static int ab8540_gpadc_vbat_true_meas_and_ibat_print(struct seq_file *s, void *p)
WARNING: line over 80 characters
+static const struct file_operations ab8540_gpadc_vbat_true_meas_and_ibat_fops = {
WARNING: line over 80 characters
+ vmain_l, vmain_h, btemp_l, btemp_h, vbat_l, vbat_h, ibat_l, ibat_h);
WARNING: quoted string split across lines
+ dev_err(dev, "debugfs error input: "
+ "should be egal to 1, 4, 8 or 16\n");
WARNING: Missing a blank line after declarations
+ char *s = b;
+ if ((*s == '0') && ((*(s+1) == 'x') || (*(s+1) == 'X'))) {
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.mask = simple_strtoul(b, &b, 0);
WARNING: simple_strtol is obsolete, use kstrtol instead
+ loc.shift = simple_strtol(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.bank = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.addr = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ val = simple_strtoul(b, &b, 0);
WARNING: quoted string split across lines
+ pr_warn("HWREG request: %s, %s, addr=0x%08X, mask=0x%X, shift=%d"
+ "value=0x%X\n", (write) ? "write" : "read",
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "sysfs_create_file failed %d\n", err);
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "request_threaded_irq failed %d, %lu\n",
ERROR: code indent should use tabs where possible
+ err, user_val);$
WARNING: please, no spaces at the start of a line
+ err, user_val);$
WARNING: Missing a blank line after declarations
+ struct resource *res;
+ debug_bank = AB8500_MISC;
ERROR: space required after that ',' (ctx:VxV)
+ sizeof(*dev_attr)*num_irqs,GFP_KERNEL);
^
WARNING: return of an errno should typically be -ve (return -ENXIO)
+ return ENXIO;
WARNING: line over 80 characters
+ file = debugfs_create_file("register-bank", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-address", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-value", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-subscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-unsubscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("all-modem-registers", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_v", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("usb_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("xtal_temp", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_xtal_temp_fops);
WARNING: line over 80 characters
+ file = debugfs_create_file("vbattruemeas", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("otp_calib", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_otp_calib_fops);
total: 2 errors, 44 warnings, 3230 lines checked
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-14 17:29:16 +00:00
|
|
|
ret = kstrtoul(b, 0, &loc.mask);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
2011-04-08 14:26:36 +00:00
|
|
|
} else if ((!strncmp(b, "-s ", 3)) ||
|
|
|
|
(!strncmp(b, "-shift ", 7))) {
|
|
|
|
b += (*(b+2) == ' ') ? 3 : 7;
|
|
|
|
if (strval_len(b) == 0)
|
|
|
|
return -EINVAL;
|
mfd: ab8500-debugfs: BIG clean-up
When checkpatch is run on ab8500-debugfs.c it screamed blue murder!
This patch fixes up all of the errors/warnings reported:
WARNING: line over 80 characters
+ err = seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO"ab8500 register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" bank 0x%02X:\n", i);
WARNING: externs should be avoided in .c files
+extern int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
WARNING: quoted string split across lines
+ pr_info("Saving all ABB registers at \"ab8500_complete_register_dump\" "
+ "for crash analyze.\n");
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "abx500_set_reg failed %d, %d", err, __LINE__);
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, "name: number: number of: wake:\n");
WARNING: line over 80 characters
+ return single_open(file, ab8500_print_modem_registers, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_btemp_ball_print, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_main_bat_v_print, inode->i_private);
WARNING: line over 80 characters
+ vbat_true_meas_convert = ab8500_gpadc_ad_to_voltage(gpadc, VBAT_TRUE_MEAS,
WARNING: line over 80 characters
+static int ab8540_gpadc_vbat_true_meas_and_ibat_print(struct seq_file *s, void *p)
WARNING: line over 80 characters
+static const struct file_operations ab8540_gpadc_vbat_true_meas_and_ibat_fops = {
WARNING: line over 80 characters
+ vmain_l, vmain_h, btemp_l, btemp_h, vbat_l, vbat_h, ibat_l, ibat_h);
WARNING: quoted string split across lines
+ dev_err(dev, "debugfs error input: "
+ "should be egal to 1, 4, 8 or 16\n");
WARNING: Missing a blank line after declarations
+ char *s = b;
+ if ((*s == '0') && ((*(s+1) == 'x') || (*(s+1) == 'X'))) {
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.mask = simple_strtoul(b, &b, 0);
WARNING: simple_strtol is obsolete, use kstrtol instead
+ loc.shift = simple_strtol(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.bank = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.addr = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ val = simple_strtoul(b, &b, 0);
WARNING: quoted string split across lines
+ pr_warn("HWREG request: %s, %s, addr=0x%08X, mask=0x%X, shift=%d"
+ "value=0x%X\n", (write) ? "write" : "read",
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "sysfs_create_file failed %d\n", err);
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "request_threaded_irq failed %d, %lu\n",
ERROR: code indent should use tabs where possible
+ err, user_val);$
WARNING: please, no spaces at the start of a line
+ err, user_val);$
WARNING: Missing a blank line after declarations
+ struct resource *res;
+ debug_bank = AB8500_MISC;
ERROR: space required after that ',' (ctx:VxV)
+ sizeof(*dev_attr)*num_irqs,GFP_KERNEL);
^
WARNING: return of an errno should typically be -ve (return -ENXIO)
+ return ENXIO;
WARNING: line over 80 characters
+ file = debugfs_create_file("register-bank", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-address", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-value", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-subscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-unsubscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("all-modem-registers", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_v", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("usb_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("xtal_temp", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_xtal_temp_fops);
WARNING: line over 80 characters
+ file = debugfs_create_file("vbattruemeas", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("otp_calib", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_otp_calib_fops);
total: 2 errors, 44 warnings, 3230 lines checked
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-14 17:29:16 +00:00
|
|
|
ret = kstrtol(b, 0, &loc.shift);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
2011-04-08 14:26:36 +00:00
|
|
|
} else {
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* get arg BANK and ADDRESS */
|
|
|
|
if (strval_len(b) == 0)
|
|
|
|
return -EINVAL;
|
mfd: ab8500-debugfs: BIG clean-up
When checkpatch is run on ab8500-debugfs.c it screamed blue murder!
This patch fixes up all of the errors/warnings reported:
WARNING: line over 80 characters
+ err = seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO"ab8500 register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" bank 0x%02X:\n", i);
WARNING: externs should be avoided in .c files
+extern int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
WARNING: quoted string split across lines
+ pr_info("Saving all ABB registers at \"ab8500_complete_register_dump\" "
+ "for crash analyze.\n");
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "abx500_set_reg failed %d, %d", err, __LINE__);
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, "name: number: number of: wake:\n");
WARNING: line over 80 characters
+ return single_open(file, ab8500_print_modem_registers, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_btemp_ball_print, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_main_bat_v_print, inode->i_private);
WARNING: line over 80 characters
+ vbat_true_meas_convert = ab8500_gpadc_ad_to_voltage(gpadc, VBAT_TRUE_MEAS,
WARNING: line over 80 characters
+static int ab8540_gpadc_vbat_true_meas_and_ibat_print(struct seq_file *s, void *p)
WARNING: line over 80 characters
+static const struct file_operations ab8540_gpadc_vbat_true_meas_and_ibat_fops = {
WARNING: line over 80 characters
+ vmain_l, vmain_h, btemp_l, btemp_h, vbat_l, vbat_h, ibat_l, ibat_h);
WARNING: quoted string split across lines
+ dev_err(dev, "debugfs error input: "
+ "should be egal to 1, 4, 8 or 16\n");
WARNING: Missing a blank line after declarations
+ char *s = b;
+ if ((*s == '0') && ((*(s+1) == 'x') || (*(s+1) == 'X'))) {
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.mask = simple_strtoul(b, &b, 0);
WARNING: simple_strtol is obsolete, use kstrtol instead
+ loc.shift = simple_strtol(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.bank = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.addr = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ val = simple_strtoul(b, &b, 0);
WARNING: quoted string split across lines
+ pr_warn("HWREG request: %s, %s, addr=0x%08X, mask=0x%X, shift=%d"
+ "value=0x%X\n", (write) ? "write" : "read",
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "sysfs_create_file failed %d\n", err);
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "request_threaded_irq failed %d, %lu\n",
ERROR: code indent should use tabs where possible
+ err, user_val);$
WARNING: please, no spaces at the start of a line
+ err, user_val);$
WARNING: Missing a blank line after declarations
+ struct resource *res;
+ debug_bank = AB8500_MISC;
ERROR: space required after that ',' (ctx:VxV)
+ sizeof(*dev_attr)*num_irqs,GFP_KERNEL);
^
WARNING: return of an errno should typically be -ve (return -ENXIO)
+ return ENXIO;
WARNING: line over 80 characters
+ file = debugfs_create_file("register-bank", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-address", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-value", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-subscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-unsubscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("all-modem-registers", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_v", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("usb_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("xtal_temp", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_xtal_temp_fops);
WARNING: line over 80 characters
+ file = debugfs_create_file("vbattruemeas", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("otp_calib", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_otp_calib_fops);
total: 2 errors, 44 warnings, 3230 lines checked
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-14 17:29:16 +00:00
|
|
|
ret = kstrtouint(b, 0, &loc.bank);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
2011-04-08 14:26:36 +00:00
|
|
|
while (*b == ' ')
|
|
|
|
b++;
|
|
|
|
if (strval_len(b) == 0)
|
|
|
|
return -EINVAL;
|
mfd: ab8500-debugfs: BIG clean-up
When checkpatch is run on ab8500-debugfs.c it screamed blue murder!
This patch fixes up all of the errors/warnings reported:
WARNING: line over 80 characters
+ err = seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO"ab8500 register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" bank 0x%02X:\n", i);
WARNING: externs should be avoided in .c files
+extern int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
WARNING: quoted string split across lines
+ pr_info("Saving all ABB registers at \"ab8500_complete_register_dump\" "
+ "for crash analyze.\n");
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "abx500_set_reg failed %d, %d", err, __LINE__);
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, "name: number: number of: wake:\n");
WARNING: line over 80 characters
+ return single_open(file, ab8500_print_modem_registers, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_btemp_ball_print, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_main_bat_v_print, inode->i_private);
WARNING: line over 80 characters
+ vbat_true_meas_convert = ab8500_gpadc_ad_to_voltage(gpadc, VBAT_TRUE_MEAS,
WARNING: line over 80 characters
+static int ab8540_gpadc_vbat_true_meas_and_ibat_print(struct seq_file *s, void *p)
WARNING: line over 80 characters
+static const struct file_operations ab8540_gpadc_vbat_true_meas_and_ibat_fops = {
WARNING: line over 80 characters
+ vmain_l, vmain_h, btemp_l, btemp_h, vbat_l, vbat_h, ibat_l, ibat_h);
WARNING: quoted string split across lines
+ dev_err(dev, "debugfs error input: "
+ "should be egal to 1, 4, 8 or 16\n");
WARNING: Missing a blank line after declarations
+ char *s = b;
+ if ((*s == '0') && ((*(s+1) == 'x') || (*(s+1) == 'X'))) {
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.mask = simple_strtoul(b, &b, 0);
WARNING: simple_strtol is obsolete, use kstrtol instead
+ loc.shift = simple_strtol(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.bank = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.addr = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ val = simple_strtoul(b, &b, 0);
WARNING: quoted string split across lines
+ pr_warn("HWREG request: %s, %s, addr=0x%08X, mask=0x%X, shift=%d"
+ "value=0x%X\n", (write) ? "write" : "read",
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "sysfs_create_file failed %d\n", err);
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "request_threaded_irq failed %d, %lu\n",
ERROR: code indent should use tabs where possible
+ err, user_val);$
WARNING: please, no spaces at the start of a line
+ err, user_val);$
WARNING: Missing a blank line after declarations
+ struct resource *res;
+ debug_bank = AB8500_MISC;
ERROR: space required after that ',' (ctx:VxV)
+ sizeof(*dev_attr)*num_irqs,GFP_KERNEL);
^
WARNING: return of an errno should typically be -ve (return -ENXIO)
+ return ENXIO;
WARNING: line over 80 characters
+ file = debugfs_create_file("register-bank", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-address", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-value", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-subscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-unsubscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("all-modem-registers", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_v", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("usb_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("xtal_temp", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_xtal_temp_fops);
WARNING: line over 80 characters
+ file = debugfs_create_file("vbattruemeas", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("otp_calib", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_otp_calib_fops);
total: 2 errors, 44 warnings, 3230 lines checked
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-14 17:29:16 +00:00
|
|
|
ret = kstrtoul(b, 0, &loc.addr);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
2011-04-08 14:26:36 +00:00
|
|
|
|
|
|
|
if (write) {
|
|
|
|
while (*b == ' ')
|
|
|
|
b++;
|
|
|
|
if (strval_len(b) == 0)
|
|
|
|
return -EINVAL;
|
mfd: ab8500-debugfs: BIG clean-up
When checkpatch is run on ab8500-debugfs.c it screamed blue murder!
This patch fixes up all of the errors/warnings reported:
WARNING: line over 80 characters
+ err = seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO"ab8500 register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" bank 0x%02X:\n", i);
WARNING: externs should be avoided in .c files
+extern int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
WARNING: quoted string split across lines
+ pr_info("Saving all ABB registers at \"ab8500_complete_register_dump\" "
+ "for crash analyze.\n");
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "abx500_set_reg failed %d, %d", err, __LINE__);
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, "name: number: number of: wake:\n");
WARNING: line over 80 characters
+ return single_open(file, ab8500_print_modem_registers, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_btemp_ball_print, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_main_bat_v_print, inode->i_private);
WARNING: line over 80 characters
+ vbat_true_meas_convert = ab8500_gpadc_ad_to_voltage(gpadc, VBAT_TRUE_MEAS,
WARNING: line over 80 characters
+static int ab8540_gpadc_vbat_true_meas_and_ibat_print(struct seq_file *s, void *p)
WARNING: line over 80 characters
+static const struct file_operations ab8540_gpadc_vbat_true_meas_and_ibat_fops = {
WARNING: line over 80 characters
+ vmain_l, vmain_h, btemp_l, btemp_h, vbat_l, vbat_h, ibat_l, ibat_h);
WARNING: quoted string split across lines
+ dev_err(dev, "debugfs error input: "
+ "should be egal to 1, 4, 8 or 16\n");
WARNING: Missing a blank line after declarations
+ char *s = b;
+ if ((*s == '0') && ((*(s+1) == 'x') || (*(s+1) == 'X'))) {
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.mask = simple_strtoul(b, &b, 0);
WARNING: simple_strtol is obsolete, use kstrtol instead
+ loc.shift = simple_strtol(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.bank = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.addr = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ val = simple_strtoul(b, &b, 0);
WARNING: quoted string split across lines
+ pr_warn("HWREG request: %s, %s, addr=0x%08X, mask=0x%X, shift=%d"
+ "value=0x%X\n", (write) ? "write" : "read",
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "sysfs_create_file failed %d\n", err);
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "request_threaded_irq failed %d, %lu\n",
ERROR: code indent should use tabs where possible
+ err, user_val);$
WARNING: please, no spaces at the start of a line
+ err, user_val);$
WARNING: Missing a blank line after declarations
+ struct resource *res;
+ debug_bank = AB8500_MISC;
ERROR: space required after that ',' (ctx:VxV)
+ sizeof(*dev_attr)*num_irqs,GFP_KERNEL);
^
WARNING: return of an errno should typically be -ve (return -ENXIO)
+ return ENXIO;
WARNING: line over 80 characters
+ file = debugfs_create_file("register-bank", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-address", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-value", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-subscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-unsubscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("all-modem-registers", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_v", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("usb_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("xtal_temp", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_xtal_temp_fops);
WARNING: line over 80 characters
+ file = debugfs_create_file("vbattruemeas", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("otp_calib", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_otp_calib_fops);
total: 2 errors, 44 warnings, 3230 lines checked
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-14 17:29:16 +00:00
|
|
|
ret = kstrtouint(b, 0, &val);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
2011-04-08 14:26:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* args are ok, update target cfg (mainly for read) */
|
|
|
|
*cfg = loc;
|
|
|
|
|
|
|
|
#ifdef ABB_HWREG_DEBUG
|
2015-10-28 09:27:32 +00:00
|
|
|
pr_warn("HWREG request: %s, %s,\n", (write) ? "write" : "read",
|
|
|
|
REG_FMT_DEC(cfg) ? "decimal" : "hexa");
|
|
|
|
pr_warn(" addr=0x%08X, mask=0x%X, shift=%d" "value=0x%X\n",
|
mfd: ab8500-debugfs: BIG clean-up
When checkpatch is run on ab8500-debugfs.c it screamed blue murder!
This patch fixes up all of the errors/warnings reported:
WARNING: line over 80 characters
+ err = seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO"ab8500 register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" bank 0x%02X:\n", i);
WARNING: externs should be avoided in .c files
+extern int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
WARNING: quoted string split across lines
+ pr_info("Saving all ABB registers at \"ab8500_complete_register_dump\" "
+ "for crash analyze.\n");
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "abx500_set_reg failed %d, %d", err, __LINE__);
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, "name: number: number of: wake:\n");
WARNING: line over 80 characters
+ return single_open(file, ab8500_print_modem_registers, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_btemp_ball_print, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_main_bat_v_print, inode->i_private);
WARNING: line over 80 characters
+ vbat_true_meas_convert = ab8500_gpadc_ad_to_voltage(gpadc, VBAT_TRUE_MEAS,
WARNING: line over 80 characters
+static int ab8540_gpadc_vbat_true_meas_and_ibat_print(struct seq_file *s, void *p)
WARNING: line over 80 characters
+static const struct file_operations ab8540_gpadc_vbat_true_meas_and_ibat_fops = {
WARNING: line over 80 characters
+ vmain_l, vmain_h, btemp_l, btemp_h, vbat_l, vbat_h, ibat_l, ibat_h);
WARNING: quoted string split across lines
+ dev_err(dev, "debugfs error input: "
+ "should be egal to 1, 4, 8 or 16\n");
WARNING: Missing a blank line after declarations
+ char *s = b;
+ if ((*s == '0') && ((*(s+1) == 'x') || (*(s+1) == 'X'))) {
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.mask = simple_strtoul(b, &b, 0);
WARNING: simple_strtol is obsolete, use kstrtol instead
+ loc.shift = simple_strtol(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.bank = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.addr = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ val = simple_strtoul(b, &b, 0);
WARNING: quoted string split across lines
+ pr_warn("HWREG request: %s, %s, addr=0x%08X, mask=0x%X, shift=%d"
+ "value=0x%X\n", (write) ? "write" : "read",
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "sysfs_create_file failed %d\n", err);
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "request_threaded_irq failed %d, %lu\n",
ERROR: code indent should use tabs where possible
+ err, user_val);$
WARNING: please, no spaces at the start of a line
+ err, user_val);$
WARNING: Missing a blank line after declarations
+ struct resource *res;
+ debug_bank = AB8500_MISC;
ERROR: space required after that ',' (ctx:VxV)
+ sizeof(*dev_attr)*num_irqs,GFP_KERNEL);
^
WARNING: return of an errno should typically be -ve (return -ENXIO)
+ return ENXIO;
WARNING: line over 80 characters
+ file = debugfs_create_file("register-bank", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-address", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-value", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-subscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-unsubscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("all-modem-registers", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_v", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("usb_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("xtal_temp", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_xtal_temp_fops);
WARNING: line over 80 characters
+ file = debugfs_create_file("vbattruemeas", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("otp_calib", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_otp_calib_fops);
total: 2 errors, 44 warnings, 3230 lines checked
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-14 17:29:16 +00:00
|
|
|
cfg->addr, cfg->mask, cfg->shift, val);
|
2011-04-08 14:26:36 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
if (!write)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
ret = abx500_get_register_interruptible(dev,
|
|
|
|
(u8)cfg->bank, (u8)cfg->addr, ®value);
|
|
|
|
if (ret < 0) {
|
|
|
|
dev_err(dev, "abx500_get_reg fail %d, %d\n",
|
|
|
|
ret, __LINE__);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cfg->shift >= 0) {
|
|
|
|
regvalue &= ~(cfg->mask << (cfg->shift));
|
|
|
|
val = (val & cfg->mask) << (cfg->shift);
|
|
|
|
} else {
|
|
|
|
regvalue &= ~(cfg->mask >> (-cfg->shift));
|
|
|
|
val = (val & cfg->mask) >> (-cfg->shift);
|
|
|
|
}
|
|
|
|
val = val | regvalue;
|
|
|
|
|
|
|
|
ret = abx500_set_register_interruptible(dev,
|
|
|
|
(u8)cfg->bank, (u8)cfg->addr, (u8)val);
|
|
|
|
if (ret < 0) {
|
|
|
|
pr_err("abx500_set_reg failed %d, %d", ret, __LINE__);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ssize_t ab8500_hwreg_write(struct file *file,
|
|
|
|
const char __user *user_buf, size_t count, loff_t *ppos)
|
|
|
|
{
|
|
|
|
struct device *dev = ((struct seq_file *)(file->private_data))->private;
|
|
|
|
char buf[128];
|
|
|
|
int buf_size, ret;
|
|
|
|
|
|
|
|
/* Get userspace string and assure termination */
|
2020-06-23 10:05:23 +00:00
|
|
|
buf_size = min((int)count, (int)(sizeof(buf)-1));
|
2011-04-08 14:26:36 +00:00
|
|
|
if (copy_from_user(buf, user_buf, buf_size))
|
|
|
|
return -EFAULT;
|
|
|
|
buf[buf_size] = 0;
|
|
|
|
|
|
|
|
/* get args and process */
|
|
|
|
ret = hwreg_common_write(buf, &hwreg_cfg, dev);
|
|
|
|
return (ret) ? ret : buf_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* - irq subscribe/unsubscribe stuff
|
|
|
|
*/
|
2013-01-14 16:10:36 +00:00
|
|
|
static int ab8500_subscribe_unsubscribe_print(struct seq_file *s, void *p)
|
|
|
|
{
|
|
|
|
seq_printf(s, "%d\n", irq_first);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ab8500_subscribe_unsubscribe_open(struct inode *inode,
|
|
|
|
struct file *file)
|
|
|
|
{
|
|
|
|
return single_open(file, ab8500_subscribe_unsubscribe_print,
|
2013-02-26 12:05:15 +00:00
|
|
|
inode->i_private);
|
2013-01-14 16:10:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2010-11-19 16:55:11 +00:00
|
|
|
* Userspace should use poll() on this file. When an event occur
|
2013-01-14 16:10:36 +00:00
|
|
|
* the blocking poll will be released.
|
|
|
|
*/
|
|
|
|
static ssize_t show_irq(struct device *dev,
|
|
|
|
struct device_attribute *attr, char *buf)
|
|
|
|
{
|
2010-11-19 16:55:11 +00:00
|
|
|
unsigned long name;
|
|
|
|
unsigned int irq_index;
|
|
|
|
int err;
|
2013-01-14 16:10:36 +00:00
|
|
|
|
2013-06-04 04:11:50 +00:00
|
|
|
err = kstrtoul(attr->attr.name, 0, &name);
|
2010-11-19 16:55:11 +00:00
|
|
|
if (err)
|
|
|
|
return err;
|
|
|
|
|
|
|
|
irq_index = name - irq_first;
|
2012-02-03 10:19:05 +00:00
|
|
|
if (irq_index >= num_irqs)
|
2010-11-19 16:55:11 +00:00
|
|
|
return -EINVAL;
|
2014-07-02 10:22:10 +00:00
|
|
|
|
|
|
|
return sprintf(buf, "%u\n", irq_count[irq_index]);
|
2010-11-19 16:55:11 +00:00
|
|
|
}
|
2013-01-14 16:10:36 +00:00
|
|
|
|
|
|
|
static ssize_t ab8500_subscribe_write(struct file *file,
|
|
|
|
const char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos)
|
|
|
|
{
|
|
|
|
struct device *dev = ((struct seq_file *)(file->private_data))->private;
|
|
|
|
unsigned long user_val;
|
|
|
|
int err;
|
2010-11-19 16:55:11 +00:00
|
|
|
unsigned int irq_index;
|
2013-01-14 16:10:36 +00:00
|
|
|
|
2012-11-23 09:41:00 +00:00
|
|
|
err = kstrtoul_from_user(user_buf, count, 0, &user_val);
|
2013-01-14 16:10:36 +00:00
|
|
|
if (err)
|
2012-11-23 09:41:00 +00:00
|
|
|
return err;
|
|
|
|
|
2013-01-14 16:10:36 +00:00
|
|
|
if (user_val < irq_first) {
|
|
|
|
dev_err(dev, "debugfs error input < %d\n", irq_first);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
if (user_val > irq_last) {
|
|
|
|
dev_err(dev, "debugfs error input > %d\n", irq_last);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2010-11-19 16:55:11 +00:00
|
|
|
irq_index = user_val - irq_first;
|
2012-02-03 10:19:05 +00:00
|
|
|
if (irq_index >= num_irqs)
|
2010-11-19 16:55:11 +00:00
|
|
|
return -EINVAL;
|
|
|
|
|
2013-01-14 16:10:36 +00:00
|
|
|
/*
|
2010-11-19 16:55:11 +00:00
|
|
|
* This will create a sysfs file named <irq-nr> which userspace can
|
2013-01-14 16:10:36 +00:00
|
|
|
* use to select or poll and get the AB8500 events
|
|
|
|
*/
|
2010-11-19 16:55:11 +00:00
|
|
|
dev_attr[irq_index] = kmalloc(sizeof(struct device_attribute),
|
|
|
|
GFP_KERNEL);
|
2013-07-19 07:44:50 +00:00
|
|
|
if (!dev_attr[irq_index])
|
|
|
|
return -ENOMEM;
|
|
|
|
|
2018-03-07 18:06:01 +00:00
|
|
|
event_name[irq_index] = kasprintf(GFP_KERNEL, "%lu", user_val);
|
2013-07-19 07:53:24 +00:00
|
|
|
if (!event_name[irq_index])
|
|
|
|
return -ENOMEM;
|
|
|
|
|
2010-11-19 16:55:11 +00:00
|
|
|
dev_attr[irq_index]->show = show_irq;
|
|
|
|
dev_attr[irq_index]->store = NULL;
|
|
|
|
dev_attr[irq_index]->attr.name = event_name[irq_index];
|
|
|
|
dev_attr[irq_index]->attr.mode = S_IRUGO;
|
|
|
|
err = sysfs_create_file(&dev->kobj, &dev_attr[irq_index]->attr);
|
2013-01-14 16:10:36 +00:00
|
|
|
if (err < 0) {
|
mfd: ab8500-debugfs: BIG clean-up
When checkpatch is run on ab8500-debugfs.c it screamed blue murder!
This patch fixes up all of the errors/warnings reported:
WARNING: line over 80 characters
+ err = seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO"ab8500 register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" bank 0x%02X:\n", i);
WARNING: externs should be avoided in .c files
+extern int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
WARNING: quoted string split across lines
+ pr_info("Saving all ABB registers at \"ab8500_complete_register_dump\" "
+ "for crash analyze.\n");
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "abx500_set_reg failed %d, %d", err, __LINE__);
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, "name: number: number of: wake:\n");
WARNING: line over 80 characters
+ return single_open(file, ab8500_print_modem_registers, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_btemp_ball_print, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_main_bat_v_print, inode->i_private);
WARNING: line over 80 characters
+ vbat_true_meas_convert = ab8500_gpadc_ad_to_voltage(gpadc, VBAT_TRUE_MEAS,
WARNING: line over 80 characters
+static int ab8540_gpadc_vbat_true_meas_and_ibat_print(struct seq_file *s, void *p)
WARNING: line over 80 characters
+static const struct file_operations ab8540_gpadc_vbat_true_meas_and_ibat_fops = {
WARNING: line over 80 characters
+ vmain_l, vmain_h, btemp_l, btemp_h, vbat_l, vbat_h, ibat_l, ibat_h);
WARNING: quoted string split across lines
+ dev_err(dev, "debugfs error input: "
+ "should be egal to 1, 4, 8 or 16\n");
WARNING: Missing a blank line after declarations
+ char *s = b;
+ if ((*s == '0') && ((*(s+1) == 'x') || (*(s+1) == 'X'))) {
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.mask = simple_strtoul(b, &b, 0);
WARNING: simple_strtol is obsolete, use kstrtol instead
+ loc.shift = simple_strtol(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.bank = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.addr = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ val = simple_strtoul(b, &b, 0);
WARNING: quoted string split across lines
+ pr_warn("HWREG request: %s, %s, addr=0x%08X, mask=0x%X, shift=%d"
+ "value=0x%X\n", (write) ? "write" : "read",
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "sysfs_create_file failed %d\n", err);
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "request_threaded_irq failed %d, %lu\n",
ERROR: code indent should use tabs where possible
+ err, user_val);$
WARNING: please, no spaces at the start of a line
+ err, user_val);$
WARNING: Missing a blank line after declarations
+ struct resource *res;
+ debug_bank = AB8500_MISC;
ERROR: space required after that ',' (ctx:VxV)
+ sizeof(*dev_attr)*num_irqs,GFP_KERNEL);
^
WARNING: return of an errno should typically be -ve (return -ENXIO)
+ return ENXIO;
WARNING: line over 80 characters
+ file = debugfs_create_file("register-bank", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-address", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-value", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-subscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-unsubscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("all-modem-registers", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_v", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("usb_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("xtal_temp", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_xtal_temp_fops);
WARNING: line over 80 characters
+ file = debugfs_create_file("vbattruemeas", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("otp_calib", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_otp_calib_fops);
total: 2 errors, 44 warnings, 3230 lines checked
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-14 17:29:16 +00:00
|
|
|
pr_info("sysfs_create_file failed %d\n", err);
|
2013-01-14 16:10:36 +00:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
err = request_threaded_irq(user_val, NULL, ab8500_debug_handler,
|
2015-05-16 18:42:15 +00:00
|
|
|
IRQF_SHARED | IRQF_NO_SUSPEND | IRQF_ONESHOT,
|
2013-01-14 16:10:36 +00:00
|
|
|
"ab8500-debug", &dev->kobj);
|
|
|
|
if (err < 0) {
|
mfd: ab8500-debugfs: BIG clean-up
When checkpatch is run on ab8500-debugfs.c it screamed blue murder!
This patch fixes up all of the errors/warnings reported:
WARNING: line over 80 characters
+ err = seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO"ab8500 register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" bank 0x%02X:\n", i);
WARNING: externs should be avoided in .c files
+extern int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
WARNING: quoted string split across lines
+ pr_info("Saving all ABB registers at \"ab8500_complete_register_dump\" "
+ "for crash analyze.\n");
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "abx500_set_reg failed %d, %d", err, __LINE__);
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, "name: number: number of: wake:\n");
WARNING: line over 80 characters
+ return single_open(file, ab8500_print_modem_registers, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_btemp_ball_print, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_main_bat_v_print, inode->i_private);
WARNING: line over 80 characters
+ vbat_true_meas_convert = ab8500_gpadc_ad_to_voltage(gpadc, VBAT_TRUE_MEAS,
WARNING: line over 80 characters
+static int ab8540_gpadc_vbat_true_meas_and_ibat_print(struct seq_file *s, void *p)
WARNING: line over 80 characters
+static const struct file_operations ab8540_gpadc_vbat_true_meas_and_ibat_fops = {
WARNING: line over 80 characters
+ vmain_l, vmain_h, btemp_l, btemp_h, vbat_l, vbat_h, ibat_l, ibat_h);
WARNING: quoted string split across lines
+ dev_err(dev, "debugfs error input: "
+ "should be egal to 1, 4, 8 or 16\n");
WARNING: Missing a blank line after declarations
+ char *s = b;
+ if ((*s == '0') && ((*(s+1) == 'x') || (*(s+1) == 'X'))) {
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.mask = simple_strtoul(b, &b, 0);
WARNING: simple_strtol is obsolete, use kstrtol instead
+ loc.shift = simple_strtol(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.bank = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.addr = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ val = simple_strtoul(b, &b, 0);
WARNING: quoted string split across lines
+ pr_warn("HWREG request: %s, %s, addr=0x%08X, mask=0x%X, shift=%d"
+ "value=0x%X\n", (write) ? "write" : "read",
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "sysfs_create_file failed %d\n", err);
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "request_threaded_irq failed %d, %lu\n",
ERROR: code indent should use tabs where possible
+ err, user_val);$
WARNING: please, no spaces at the start of a line
+ err, user_val);$
WARNING: Missing a blank line after declarations
+ struct resource *res;
+ debug_bank = AB8500_MISC;
ERROR: space required after that ',' (ctx:VxV)
+ sizeof(*dev_attr)*num_irqs,GFP_KERNEL);
^
WARNING: return of an errno should typically be -ve (return -ENXIO)
+ return ENXIO;
WARNING: line over 80 characters
+ file = debugfs_create_file("register-bank", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-address", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-value", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-subscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-unsubscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("all-modem-registers", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_v", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("usb_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("xtal_temp", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_xtal_temp_fops);
WARNING: line over 80 characters
+ file = debugfs_create_file("vbattruemeas", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("otp_calib", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_otp_calib_fops);
total: 2 errors, 44 warnings, 3230 lines checked
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-14 17:29:16 +00:00
|
|
|
pr_info("request_threaded_irq failed %d, %lu\n",
|
|
|
|
err, user_val);
|
2010-11-19 16:55:11 +00:00
|
|
|
sysfs_remove_file(&dev->kobj, &dev_attr[irq_index]->attr);
|
2013-01-14 16:10:36 +00:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2012-11-23 09:41:00 +00:00
|
|
|
return count;
|
2013-01-14 16:10:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ssize_t ab8500_unsubscribe_write(struct file *file,
|
|
|
|
const char __user *user_buf,
|
|
|
|
size_t count, loff_t *ppos)
|
|
|
|
{
|
|
|
|
struct device *dev = ((struct seq_file *)(file->private_data))->private;
|
|
|
|
unsigned long user_val;
|
|
|
|
int err;
|
2010-11-19 16:55:11 +00:00
|
|
|
unsigned int irq_index;
|
2013-01-14 16:10:36 +00:00
|
|
|
|
2012-11-23 09:41:00 +00:00
|
|
|
err = kstrtoul_from_user(user_buf, count, 0, &user_val);
|
2013-01-14 16:10:36 +00:00
|
|
|
if (err)
|
2012-11-23 09:41:00 +00:00
|
|
|
return err;
|
|
|
|
|
2013-01-14 16:10:36 +00:00
|
|
|
if (user_val < irq_first) {
|
|
|
|
dev_err(dev, "debugfs error input < %d\n", irq_first);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
if (user_val > irq_last) {
|
|
|
|
dev_err(dev, "debugfs error input > %d\n", irq_last);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2010-11-19 16:55:11 +00:00
|
|
|
irq_index = user_val - irq_first;
|
2012-02-03 10:19:05 +00:00
|
|
|
if (irq_index >= num_irqs)
|
2010-11-19 16:55:11 +00:00
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
/* Set irq count to 0 when unsubscribe */
|
|
|
|
irq_count[irq_index] = 0;
|
|
|
|
|
|
|
|
if (dev_attr[irq_index])
|
|
|
|
sysfs_remove_file(&dev->kobj, &dev_attr[irq_index]->attr);
|
2013-01-14 16:10:36 +00:00
|
|
|
|
2010-11-19 16:55:11 +00:00
|
|
|
|
|
|
|
free_irq(user_val, &dev->kobj);
|
|
|
|
kfree(event_name[irq_index]);
|
|
|
|
kfree(dev_attr[irq_index]);
|
2013-01-14 16:10:36 +00:00
|
|
|
|
2012-11-23 09:41:00 +00:00
|
|
|
return count;
|
2013-01-14 16:10:36 +00:00
|
|
|
}
|
|
|
|
|
2011-04-08 14:26:36 +00:00
|
|
|
/*
|
2019-04-30 15:17:26 +00:00
|
|
|
* - several debugfs nodes fops
|
2011-04-08 14:26:36 +00:00
|
|
|
*/
|
|
|
|
|
2010-09-13 14:05:04 +00:00
|
|
|
static const struct file_operations ab8500_bank_fops = {
|
2010-11-26 12:06:39 +00:00
|
|
|
.open = ab8500_bank_open,
|
|
|
|
.write = ab8500_bank_write,
|
|
|
|
.read = seq_read,
|
|
|
|
.llseek = seq_lseek,
|
|
|
|
.release = single_release,
|
|
|
|
.owner = THIS_MODULE,
|
2010-09-13 14:05:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const struct file_operations ab8500_address_fops = {
|
2010-11-26 12:06:39 +00:00
|
|
|
.open = ab8500_address_open,
|
|
|
|
.write = ab8500_address_write,
|
|
|
|
.read = seq_read,
|
|
|
|
.llseek = seq_lseek,
|
|
|
|
.release = single_release,
|
|
|
|
.owner = THIS_MODULE,
|
2010-09-13 14:05:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const struct file_operations ab8500_val_fops = {
|
2010-11-26 12:06:39 +00:00
|
|
|
.open = ab8500_val_open,
|
|
|
|
.write = ab8500_val_write,
|
|
|
|
.read = seq_read,
|
|
|
|
.llseek = seq_lseek,
|
|
|
|
.release = single_release,
|
|
|
|
.owner = THIS_MODULE,
|
2010-09-13 14:05:04 +00:00
|
|
|
};
|
|
|
|
|
2013-01-14 16:10:36 +00:00
|
|
|
static const struct file_operations ab8500_subscribe_fops = {
|
|
|
|
.open = ab8500_subscribe_unsubscribe_open,
|
|
|
|
.write = ab8500_subscribe_write,
|
|
|
|
.read = seq_read,
|
|
|
|
.llseek = seq_lseek,
|
|
|
|
.release = single_release,
|
|
|
|
.owner = THIS_MODULE,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct file_operations ab8500_unsubscribe_fops = {
|
|
|
|
.open = ab8500_subscribe_unsubscribe_open,
|
|
|
|
.write = ab8500_unsubscribe_write,
|
|
|
|
.read = seq_read,
|
|
|
|
.llseek = seq_lseek,
|
|
|
|
.release = single_release,
|
|
|
|
.owner = THIS_MODULE,
|
|
|
|
};
|
|
|
|
|
2011-04-08 14:26:36 +00:00
|
|
|
static const struct file_operations ab8500_hwreg_fops = {
|
|
|
|
.open = ab8500_hwreg_open,
|
|
|
|
.write = ab8500_hwreg_write,
|
|
|
|
.read = seq_read,
|
|
|
|
.llseek = seq_lseek,
|
|
|
|
.release = single_release,
|
|
|
|
.owner = THIS_MODULE,
|
|
|
|
};
|
|
|
|
|
2012-11-19 18:23:04 +00:00
|
|
|
static int ab8500_debug_probe(struct platform_device *plf)
|
2010-09-13 14:05:04 +00:00
|
|
|
{
|
2019-07-06 16:47:21 +00:00
|
|
|
struct dentry *ab8500_dir;
|
2012-02-03 10:19:05 +00:00
|
|
|
struct ab8500 *ab8500;
|
2013-04-12 15:02:09 +00:00
|
|
|
struct resource *res;
|
mfd: ab8500-debugfs: BIG clean-up
When checkpatch is run on ab8500-debugfs.c it screamed blue murder!
This patch fixes up all of the errors/warnings reported:
WARNING: line over 80 characters
+ err = seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO"ab8500 register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" bank 0x%02X:\n", i);
WARNING: externs should be avoided in .c files
+extern int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
WARNING: quoted string split across lines
+ pr_info("Saving all ABB registers at \"ab8500_complete_register_dump\" "
+ "for crash analyze.\n");
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "abx500_set_reg failed %d, %d", err, __LINE__);
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, "name: number: number of: wake:\n");
WARNING: line over 80 characters
+ return single_open(file, ab8500_print_modem_registers, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_btemp_ball_print, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_main_bat_v_print, inode->i_private);
WARNING: line over 80 characters
+ vbat_true_meas_convert = ab8500_gpadc_ad_to_voltage(gpadc, VBAT_TRUE_MEAS,
WARNING: line over 80 characters
+static int ab8540_gpadc_vbat_true_meas_and_ibat_print(struct seq_file *s, void *p)
WARNING: line over 80 characters
+static const struct file_operations ab8540_gpadc_vbat_true_meas_and_ibat_fops = {
WARNING: line over 80 characters
+ vmain_l, vmain_h, btemp_l, btemp_h, vbat_l, vbat_h, ibat_l, ibat_h);
WARNING: quoted string split across lines
+ dev_err(dev, "debugfs error input: "
+ "should be egal to 1, 4, 8 or 16\n");
WARNING: Missing a blank line after declarations
+ char *s = b;
+ if ((*s == '0') && ((*(s+1) == 'x') || (*(s+1) == 'X'))) {
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.mask = simple_strtoul(b, &b, 0);
WARNING: simple_strtol is obsolete, use kstrtol instead
+ loc.shift = simple_strtol(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.bank = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.addr = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ val = simple_strtoul(b, &b, 0);
WARNING: quoted string split across lines
+ pr_warn("HWREG request: %s, %s, addr=0x%08X, mask=0x%X, shift=%d"
+ "value=0x%X\n", (write) ? "write" : "read",
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "sysfs_create_file failed %d\n", err);
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "request_threaded_irq failed %d, %lu\n",
ERROR: code indent should use tabs where possible
+ err, user_val);$
WARNING: please, no spaces at the start of a line
+ err, user_val);$
WARNING: Missing a blank line after declarations
+ struct resource *res;
+ debug_bank = AB8500_MISC;
ERROR: space required after that ',' (ctx:VxV)
+ sizeof(*dev_attr)*num_irqs,GFP_KERNEL);
^
WARNING: return of an errno should typically be -ve (return -ENXIO)
+ return ENXIO;
WARNING: line over 80 characters
+ file = debugfs_create_file("register-bank", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-address", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-value", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-subscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-unsubscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("all-modem-registers", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_v", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("usb_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("xtal_temp", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_xtal_temp_fops);
WARNING: line over 80 characters
+ file = debugfs_create_file("vbattruemeas", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("otp_calib", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_otp_calib_fops);
total: 2 errors, 44 warnings, 3230 lines checked
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-14 17:29:16 +00:00
|
|
|
|
2010-11-26 12:06:39 +00:00
|
|
|
debug_bank = AB8500_MISC;
|
|
|
|
debug_address = AB8500_REV_REG & 0x00FF;
|
2010-09-13 14:05:04 +00:00
|
|
|
|
2012-02-03 10:19:05 +00:00
|
|
|
ab8500 = dev_get_drvdata(plf->dev.parent);
|
|
|
|
num_irqs = ab8500->mask_size;
|
|
|
|
|
treewide: devm_kzalloc() -> devm_kcalloc()
The devm_kzalloc() function has a 2-factor argument form, devm_kcalloc().
This patch replaces cases of:
devm_kzalloc(handle, a * b, gfp)
with:
devm_kcalloc(handle, a * b, gfp)
as well as handling cases of:
devm_kzalloc(handle, a * b * c, gfp)
with:
devm_kzalloc(handle, array3_size(a, b, c), gfp)
as it's slightly less ugly than:
devm_kcalloc(handle, array_size(a, b), c, gfp)
This does, however, attempt to ignore constant size factors like:
devm_kzalloc(handle, 4 * 1024, gfp)
though any constants defined via macros get caught up in the conversion.
Any factors with a sizeof() of "unsigned char", "char", and "u8" were
dropped, since they're redundant.
Some manual whitespace fixes were needed in this patch, as Coccinelle
really liked to write "=devm_kcalloc..." instead of "= devm_kcalloc...".
The Coccinelle script used for this was:
// Fix redundant parens around sizeof().
@@
expression HANDLE;
type TYPE;
expression THING, E;
@@
(
devm_kzalloc(HANDLE,
- (sizeof(TYPE)) * E
+ sizeof(TYPE) * E
, ...)
|
devm_kzalloc(HANDLE,
- (sizeof(THING)) * E
+ sizeof(THING) * E
, ...)
)
// Drop single-byte sizes and redundant parens.
@@
expression HANDLE;
expression COUNT;
typedef u8;
typedef __u8;
@@
(
devm_kzalloc(HANDLE,
- sizeof(u8) * (COUNT)
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(__u8) * (COUNT)
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(char) * (COUNT)
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(unsigned char) * (COUNT)
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(u8) * COUNT
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(__u8) * COUNT
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(char) * COUNT
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(unsigned char) * COUNT
+ COUNT
, ...)
)
// 2-factor product with sizeof(type/expression) and identifier or constant.
@@
expression HANDLE;
type TYPE;
expression THING;
identifier COUNT_ID;
constant COUNT_CONST;
@@
(
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * (COUNT_ID)
+ COUNT_ID, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * COUNT_ID
+ COUNT_ID, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * (COUNT_CONST)
+ COUNT_CONST, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * COUNT_CONST
+ COUNT_CONST, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * (COUNT_ID)
+ COUNT_ID, sizeof(THING)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * COUNT_ID
+ COUNT_ID, sizeof(THING)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * (COUNT_CONST)
+ COUNT_CONST, sizeof(THING)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * COUNT_CONST
+ COUNT_CONST, sizeof(THING)
, ...)
)
// 2-factor product, only identifiers.
@@
expression HANDLE;
identifier SIZE, COUNT;
@@
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- SIZE * COUNT
+ COUNT, SIZE
, ...)
// 3-factor product with 1 sizeof(type) or sizeof(expression), with
// redundant parens removed.
@@
expression HANDLE;
expression THING;
identifier STRIDE, COUNT;
type TYPE;
@@
(
devm_kzalloc(HANDLE,
- sizeof(TYPE) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
)
// 3-factor product with 2 sizeof(variable), with redundant parens removed.
@@
expression HANDLE;
expression THING1, THING2;
identifier COUNT;
type TYPE1, TYPE2;
@@
(
devm_kzalloc(HANDLE,
- sizeof(TYPE1) * sizeof(TYPE2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
)
// 3-factor product, only identifiers, with redundant parens removed.
@@
expression HANDLE;
identifier STRIDE, SIZE, COUNT;
@@
(
devm_kzalloc(HANDLE,
- (COUNT) * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- COUNT * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- COUNT * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- (COUNT) * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- COUNT * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- (COUNT) * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- (COUNT) * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- COUNT * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
)
// Any remaining multi-factor products, first at least 3-factor products,
// when they're not all constants...
@@
expression HANDLE;
expression E1, E2, E3;
constant C1, C2, C3;
@@
(
devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
|
devm_kzalloc(HANDLE,
- (E1) * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
|
devm_kzalloc(HANDLE,
- (E1) * (E2) * E3
+ array3_size(E1, E2, E3)
, ...)
|
devm_kzalloc(HANDLE,
- (E1) * (E2) * (E3)
+ array3_size(E1, E2, E3)
, ...)
|
devm_kzalloc(HANDLE,
- E1 * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
)
// And then all remaining 2 factors products when they're not all constants,
// keeping sizeof() as the second factor argument.
@@
expression HANDLE;
expression THING, E1, E2;
type TYPE;
constant C1, C2, C3;
@@
(
devm_kzalloc(HANDLE, sizeof(THING) * C2, ...)
|
devm_kzalloc(HANDLE, sizeof(TYPE) * C2, ...)
|
devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
|
devm_kzalloc(HANDLE, C1 * C2, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * (E2)
+ E2, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * E2
+ E2, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * (E2)
+ E2, sizeof(THING)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * E2
+ E2, sizeof(THING)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- (E1) * E2
+ E1, E2
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- (E1) * (E2)
+ E1, E2
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- E1 * E2
+ E1, E2
, ...)
)
Signed-off-by: Kees Cook <keescook@chromium.org>
2018-06-12 21:07:58 +00:00
|
|
|
irq_count = devm_kcalloc(&plf->dev,
|
|
|
|
num_irqs, sizeof(*irq_count), GFP_KERNEL);
|
2012-02-03 10:19:05 +00:00
|
|
|
if (!irq_count)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
treewide: devm_kzalloc() -> devm_kcalloc()
The devm_kzalloc() function has a 2-factor argument form, devm_kcalloc().
This patch replaces cases of:
devm_kzalloc(handle, a * b, gfp)
with:
devm_kcalloc(handle, a * b, gfp)
as well as handling cases of:
devm_kzalloc(handle, a * b * c, gfp)
with:
devm_kzalloc(handle, array3_size(a, b, c), gfp)
as it's slightly less ugly than:
devm_kcalloc(handle, array_size(a, b), c, gfp)
This does, however, attempt to ignore constant size factors like:
devm_kzalloc(handle, 4 * 1024, gfp)
though any constants defined via macros get caught up in the conversion.
Any factors with a sizeof() of "unsigned char", "char", and "u8" were
dropped, since they're redundant.
Some manual whitespace fixes were needed in this patch, as Coccinelle
really liked to write "=devm_kcalloc..." instead of "= devm_kcalloc...".
The Coccinelle script used for this was:
// Fix redundant parens around sizeof().
@@
expression HANDLE;
type TYPE;
expression THING, E;
@@
(
devm_kzalloc(HANDLE,
- (sizeof(TYPE)) * E
+ sizeof(TYPE) * E
, ...)
|
devm_kzalloc(HANDLE,
- (sizeof(THING)) * E
+ sizeof(THING) * E
, ...)
)
// Drop single-byte sizes and redundant parens.
@@
expression HANDLE;
expression COUNT;
typedef u8;
typedef __u8;
@@
(
devm_kzalloc(HANDLE,
- sizeof(u8) * (COUNT)
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(__u8) * (COUNT)
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(char) * (COUNT)
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(unsigned char) * (COUNT)
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(u8) * COUNT
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(__u8) * COUNT
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(char) * COUNT
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(unsigned char) * COUNT
+ COUNT
, ...)
)
// 2-factor product with sizeof(type/expression) and identifier or constant.
@@
expression HANDLE;
type TYPE;
expression THING;
identifier COUNT_ID;
constant COUNT_CONST;
@@
(
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * (COUNT_ID)
+ COUNT_ID, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * COUNT_ID
+ COUNT_ID, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * (COUNT_CONST)
+ COUNT_CONST, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * COUNT_CONST
+ COUNT_CONST, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * (COUNT_ID)
+ COUNT_ID, sizeof(THING)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * COUNT_ID
+ COUNT_ID, sizeof(THING)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * (COUNT_CONST)
+ COUNT_CONST, sizeof(THING)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * COUNT_CONST
+ COUNT_CONST, sizeof(THING)
, ...)
)
// 2-factor product, only identifiers.
@@
expression HANDLE;
identifier SIZE, COUNT;
@@
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- SIZE * COUNT
+ COUNT, SIZE
, ...)
// 3-factor product with 1 sizeof(type) or sizeof(expression), with
// redundant parens removed.
@@
expression HANDLE;
expression THING;
identifier STRIDE, COUNT;
type TYPE;
@@
(
devm_kzalloc(HANDLE,
- sizeof(TYPE) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
)
// 3-factor product with 2 sizeof(variable), with redundant parens removed.
@@
expression HANDLE;
expression THING1, THING2;
identifier COUNT;
type TYPE1, TYPE2;
@@
(
devm_kzalloc(HANDLE,
- sizeof(TYPE1) * sizeof(TYPE2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
)
// 3-factor product, only identifiers, with redundant parens removed.
@@
expression HANDLE;
identifier STRIDE, SIZE, COUNT;
@@
(
devm_kzalloc(HANDLE,
- (COUNT) * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- COUNT * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- COUNT * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- (COUNT) * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- COUNT * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- (COUNT) * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- (COUNT) * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- COUNT * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
)
// Any remaining multi-factor products, first at least 3-factor products,
// when they're not all constants...
@@
expression HANDLE;
expression E1, E2, E3;
constant C1, C2, C3;
@@
(
devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
|
devm_kzalloc(HANDLE,
- (E1) * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
|
devm_kzalloc(HANDLE,
- (E1) * (E2) * E3
+ array3_size(E1, E2, E3)
, ...)
|
devm_kzalloc(HANDLE,
- (E1) * (E2) * (E3)
+ array3_size(E1, E2, E3)
, ...)
|
devm_kzalloc(HANDLE,
- E1 * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
)
// And then all remaining 2 factors products when they're not all constants,
// keeping sizeof() as the second factor argument.
@@
expression HANDLE;
expression THING, E1, E2;
type TYPE;
constant C1, C2, C3;
@@
(
devm_kzalloc(HANDLE, sizeof(THING) * C2, ...)
|
devm_kzalloc(HANDLE, sizeof(TYPE) * C2, ...)
|
devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
|
devm_kzalloc(HANDLE, C1 * C2, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * (E2)
+ E2, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * E2
+ E2, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * (E2)
+ E2, sizeof(THING)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * E2
+ E2, sizeof(THING)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- (E1) * E2
+ E1, E2
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- (E1) * (E2)
+ E1, E2
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- E1 * E2
+ E1, E2
, ...)
)
Signed-off-by: Kees Cook <keescook@chromium.org>
2018-06-12 21:07:58 +00:00
|
|
|
dev_attr = devm_kcalloc(&plf->dev,
|
|
|
|
num_irqs, sizeof(*dev_attr), GFP_KERNEL);
|
2012-02-03 10:19:05 +00:00
|
|
|
if (!dev_attr)
|
2013-05-23 15:25:05 +00:00
|
|
|
return -ENOMEM;
|
2012-02-03 10:19:05 +00:00
|
|
|
|
treewide: devm_kzalloc() -> devm_kcalloc()
The devm_kzalloc() function has a 2-factor argument form, devm_kcalloc().
This patch replaces cases of:
devm_kzalloc(handle, a * b, gfp)
with:
devm_kcalloc(handle, a * b, gfp)
as well as handling cases of:
devm_kzalloc(handle, a * b * c, gfp)
with:
devm_kzalloc(handle, array3_size(a, b, c), gfp)
as it's slightly less ugly than:
devm_kcalloc(handle, array_size(a, b), c, gfp)
This does, however, attempt to ignore constant size factors like:
devm_kzalloc(handle, 4 * 1024, gfp)
though any constants defined via macros get caught up in the conversion.
Any factors with a sizeof() of "unsigned char", "char", and "u8" were
dropped, since they're redundant.
Some manual whitespace fixes were needed in this patch, as Coccinelle
really liked to write "=devm_kcalloc..." instead of "= devm_kcalloc...".
The Coccinelle script used for this was:
// Fix redundant parens around sizeof().
@@
expression HANDLE;
type TYPE;
expression THING, E;
@@
(
devm_kzalloc(HANDLE,
- (sizeof(TYPE)) * E
+ sizeof(TYPE) * E
, ...)
|
devm_kzalloc(HANDLE,
- (sizeof(THING)) * E
+ sizeof(THING) * E
, ...)
)
// Drop single-byte sizes and redundant parens.
@@
expression HANDLE;
expression COUNT;
typedef u8;
typedef __u8;
@@
(
devm_kzalloc(HANDLE,
- sizeof(u8) * (COUNT)
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(__u8) * (COUNT)
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(char) * (COUNT)
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(unsigned char) * (COUNT)
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(u8) * COUNT
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(__u8) * COUNT
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(char) * COUNT
+ COUNT
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(unsigned char) * COUNT
+ COUNT
, ...)
)
// 2-factor product with sizeof(type/expression) and identifier or constant.
@@
expression HANDLE;
type TYPE;
expression THING;
identifier COUNT_ID;
constant COUNT_CONST;
@@
(
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * (COUNT_ID)
+ COUNT_ID, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * COUNT_ID
+ COUNT_ID, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * (COUNT_CONST)
+ COUNT_CONST, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * COUNT_CONST
+ COUNT_CONST, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * (COUNT_ID)
+ COUNT_ID, sizeof(THING)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * COUNT_ID
+ COUNT_ID, sizeof(THING)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * (COUNT_CONST)
+ COUNT_CONST, sizeof(THING)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * COUNT_CONST
+ COUNT_CONST, sizeof(THING)
, ...)
)
// 2-factor product, only identifiers.
@@
expression HANDLE;
identifier SIZE, COUNT;
@@
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- SIZE * COUNT
+ COUNT, SIZE
, ...)
// 3-factor product with 1 sizeof(type) or sizeof(expression), with
// redundant parens removed.
@@
expression HANDLE;
expression THING;
identifier STRIDE, COUNT;
type TYPE;
@@
(
devm_kzalloc(HANDLE,
- sizeof(TYPE) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
)
// 3-factor product with 2 sizeof(variable), with redundant parens removed.
@@
expression HANDLE;
expression THING1, THING2;
identifier COUNT;
type TYPE1, TYPE2;
@@
(
devm_kzalloc(HANDLE,
- sizeof(TYPE1) * sizeof(TYPE2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(THING1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
|
devm_kzalloc(HANDLE,
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
)
// 3-factor product, only identifiers, with redundant parens removed.
@@
expression HANDLE;
identifier STRIDE, SIZE, COUNT;
@@
(
devm_kzalloc(HANDLE,
- (COUNT) * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- COUNT * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- COUNT * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- (COUNT) * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- COUNT * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- (COUNT) * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- (COUNT) * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
devm_kzalloc(HANDLE,
- COUNT * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
)
// Any remaining multi-factor products, first at least 3-factor products,
// when they're not all constants...
@@
expression HANDLE;
expression E1, E2, E3;
constant C1, C2, C3;
@@
(
devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
|
devm_kzalloc(HANDLE,
- (E1) * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
|
devm_kzalloc(HANDLE,
- (E1) * (E2) * E3
+ array3_size(E1, E2, E3)
, ...)
|
devm_kzalloc(HANDLE,
- (E1) * (E2) * (E3)
+ array3_size(E1, E2, E3)
, ...)
|
devm_kzalloc(HANDLE,
- E1 * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
)
// And then all remaining 2 factors products when they're not all constants,
// keeping sizeof() as the second factor argument.
@@
expression HANDLE;
expression THING, E1, E2;
type TYPE;
constant C1, C2, C3;
@@
(
devm_kzalloc(HANDLE, sizeof(THING) * C2, ...)
|
devm_kzalloc(HANDLE, sizeof(TYPE) * C2, ...)
|
devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
|
devm_kzalloc(HANDLE, C1 * C2, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * (E2)
+ E2, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(TYPE) * E2
+ E2, sizeof(TYPE)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * (E2)
+ E2, sizeof(THING)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- sizeof(THING) * E2
+ E2, sizeof(THING)
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- (E1) * E2
+ E1, E2
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- (E1) * (E2)
+ E1, E2
, ...)
|
- devm_kzalloc
+ devm_kcalloc
(HANDLE,
- E1 * E2
+ E1, E2
, ...)
)
Signed-off-by: Kees Cook <keescook@chromium.org>
2018-06-12 21:07:58 +00:00
|
|
|
event_name = devm_kcalloc(&plf->dev,
|
|
|
|
num_irqs, sizeof(*event_name), GFP_KERNEL);
|
2012-02-03 10:19:05 +00:00
|
|
|
if (!event_name)
|
2013-05-23 15:25:05 +00:00
|
|
|
return -ENOMEM;
|
2012-02-03 10:19:05 +00:00
|
|
|
|
2013-04-12 15:02:09 +00:00
|
|
|
res = platform_get_resource_byname(plf, 0, "IRQ_AB8500");
|
|
|
|
if (!res) {
|
mfd: ab8500-debugfs: BIG clean-up
When checkpatch is run on ab8500-debugfs.c it screamed blue murder!
This patch fixes up all of the errors/warnings reported:
WARNING: line over 80 characters
+ err = seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" [0x%02X/0x%02X]: 0x%02X\n",
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, AB8500_NAME_STRING " register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO"ab8500 register values:\n");
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
+ printk(KERN_INFO" bank 0x%02X:\n", i);
WARNING: externs should be avoided in .c files
+extern int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
WARNING: quoted string split across lines
+ pr_info("Saving all ABB registers at \"ab8500_complete_register_dump\" "
+ "for crash analyze.\n");
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "abx500_set_reg failed %d, %d", err, __LINE__);
WARNING: Prefer seq_puts to seq_printf
+ seq_printf(s, "name: number: number of: wake:\n");
WARNING: line over 80 characters
+ return single_open(file, ab8500_print_modem_registers, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_btemp_ball_print, inode->i_private);
WARNING: line over 80 characters
+ return single_open(file, ab8500_gpadc_main_bat_v_print, inode->i_private);
WARNING: line over 80 characters
+ vbat_true_meas_convert = ab8500_gpadc_ad_to_voltage(gpadc, VBAT_TRUE_MEAS,
WARNING: line over 80 characters
+static int ab8540_gpadc_vbat_true_meas_and_ibat_print(struct seq_file *s, void *p)
WARNING: line over 80 characters
+static const struct file_operations ab8540_gpadc_vbat_true_meas_and_ibat_fops = {
WARNING: line over 80 characters
+ vmain_l, vmain_h, btemp_l, btemp_h, vbat_l, vbat_h, ibat_l, ibat_h);
WARNING: quoted string split across lines
+ dev_err(dev, "debugfs error input: "
+ "should be egal to 1, 4, 8 or 16\n");
WARNING: Missing a blank line after declarations
+ char *s = b;
+ if ((*s == '0') && ((*(s+1) == 'x') || (*(s+1) == 'X'))) {
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.mask = simple_strtoul(b, &b, 0);
WARNING: simple_strtol is obsolete, use kstrtol instead
+ loc.shift = simple_strtol(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.bank = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ loc.addr = simple_strtoul(b, &b, 0);
WARNING: simple_strtoul is obsolete, use kstrtoul instead
+ val = simple_strtoul(b, &b, 0);
WARNING: quoted string split across lines
+ pr_warn("HWREG request: %s, %s, addr=0x%08X, mask=0x%X, shift=%d"
+ "value=0x%X\n", (write) ? "write" : "read",
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "sysfs_create_file failed %d\n", err);
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR "request_threaded_irq failed %d, %lu\n",
ERROR: code indent should use tabs where possible
+ err, user_val);$
WARNING: please, no spaces at the start of a line
+ err, user_val);$
WARNING: Missing a blank line after declarations
+ struct resource *res;
+ debug_bank = AB8500_MISC;
ERROR: space required after that ',' (ctx:VxV)
+ sizeof(*dev_attr)*num_irqs,GFP_KERNEL);
^
WARNING: return of an errno should typically be -ve (return -ENXIO)
+ return ENXIO;
WARNING: line over 80 characters
+ file = debugfs_create_file("register-bank", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-address", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("register-value", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-subscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("irq-unsubscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("all-modem-registers", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_v", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("main_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("usb_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("xtal_temp", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_xtal_temp_fops);
WARNING: line over 80 characters
+ file = debugfs_create_file("vbattruemeas", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ file = debugfs_create_file("otp_calib", (S_IRUGO | S_IWUSR | S_IWGRP),
WARNING: line over 80 characters
+ ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_otp_calib_fops);
total: 2 errors, 44 warnings, 3230 lines checked
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-14 17:29:16 +00:00
|
|
|
dev_err(&plf->dev, "AB8500 irq not found, err %d\n", irq_first);
|
|
|
|
return -ENXIO;
|
2013-04-12 15:02:09 +00:00
|
|
|
}
|
|
|
|
irq_ab8500 = res->start;
|
|
|
|
|
2013-01-14 16:10:36 +00:00
|
|
|
irq_first = platform_get_irq_byname(plf, "IRQ_FIRST");
|
2019-07-30 18:15:27 +00:00
|
|
|
if (irq_first < 0)
|
2013-05-23 15:25:05 +00:00
|
|
|
return irq_first;
|
2013-01-14 16:10:36 +00:00
|
|
|
|
|
|
|
irq_last = platform_get_irq_byname(plf, "IRQ_LAST");
|
2019-07-30 18:15:27 +00:00
|
|
|
if (irq_last < 0)
|
2013-05-23 15:25:05 +00:00
|
|
|
return irq_last;
|
2013-01-14 16:10:36 +00:00
|
|
|
|
2010-11-26 12:06:39 +00:00
|
|
|
ab8500_dir = debugfs_create_dir(AB8500_NAME_STRING, NULL);
|
2010-09-13 14:05:04 +00:00
|
|
|
|
2019-07-06 16:47:21 +00:00
|
|
|
debugfs_create_file("all-bank-registers", S_IRUGO, ab8500_dir,
|
|
|
|
&plf->dev, &ab8500_bank_registers_fops);
|
|
|
|
debugfs_create_file("all-banks", S_IRUGO, ab8500_dir,
|
|
|
|
&plf->dev, &ab8500_all_banks_fops);
|
|
|
|
debugfs_create_file("register-bank", (S_IRUGO | S_IWUSR | S_IWGRP),
|
|
|
|
ab8500_dir, &plf->dev, &ab8500_bank_fops);
|
|
|
|
debugfs_create_file("register-address", (S_IRUGO | S_IWUSR | S_IWGRP),
|
|
|
|
ab8500_dir, &plf->dev, &ab8500_address_fops);
|
|
|
|
debugfs_create_file("register-value", (S_IRUGO | S_IWUSR | S_IWGRP),
|
|
|
|
ab8500_dir, &plf->dev, &ab8500_val_fops);
|
|
|
|
debugfs_create_file("irq-subscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
|
|
|
|
ab8500_dir, &plf->dev, &ab8500_subscribe_fops);
|
2011-05-31 12:54:27 +00:00
|
|
|
|
2012-07-06 14:11:50 +00:00
|
|
|
if (is_ab8500(ab8500)) {
|
|
|
|
debug_ranges = ab8500_debug_ranges;
|
2012-02-14 12:01:00 +00:00
|
|
|
num_interrupt_lines = AB8500_NR_IRQS;
|
2012-07-06 14:11:50 +00:00
|
|
|
} else if (is_ab8505(ab8500)) {
|
|
|
|
debug_ranges = ab8505_debug_ranges;
|
2012-02-14 12:01:00 +00:00
|
|
|
num_interrupt_lines = AB8505_NR_IRQS;
|
2012-07-06 14:11:50 +00:00
|
|
|
} else if (is_ab9540(ab8500)) {
|
|
|
|
debug_ranges = ab8505_debug_ranges;
|
2012-02-14 12:01:00 +00:00
|
|
|
num_interrupt_lines = AB9540_NR_IRQS;
|
2012-07-06 14:11:50 +00:00
|
|
|
} else if (is_ab8540(ab8500)) {
|
2012-11-19 11:20:03 +00:00
|
|
|
debug_ranges = ab8540_debug_ranges;
|
2013-02-26 10:09:41 +00:00
|
|
|
num_interrupt_lines = AB8540_NR_IRQS;
|
2012-07-06 14:11:50 +00:00
|
|
|
}
|
2012-02-14 12:01:00 +00:00
|
|
|
|
2019-07-06 16:47:21 +00:00
|
|
|
debugfs_create_file("interrupts", (S_IRUGO), ab8500_dir, &plf->dev,
|
|
|
|
&ab8500_interrupts_fops);
|
|
|
|
debugfs_create_file("irq-unsubscribe", (S_IRUGO | S_IWUSR | S_IWGRP),
|
|
|
|
ab8500_dir, &plf->dev, &ab8500_unsubscribe_fops);
|
|
|
|
debugfs_create_file("hwreg", (S_IRUGO | S_IWUSR | S_IWGRP), ab8500_dir,
|
|
|
|
&plf->dev, &ab8500_hwreg_fops);
|
|
|
|
debugfs_create_file("all-modem-registers", (S_IRUGO | S_IWUSR | S_IWGRP),
|
|
|
|
ab8500_dir, &plf->dev, &ab8500_modem_fops);
|
2013-01-14 16:10:36 +00:00
|
|
|
|
2010-11-26 12:06:39 +00:00
|
|
|
return 0;
|
2010-09-13 14:05:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct platform_driver ab8500_debug_driver = {
|
2010-11-26 12:06:39 +00:00
|
|
|
.driver = {
|
|
|
|
.name = "ab8500-debug",
|
2016-10-30 01:24:37 +00:00
|
|
|
.suppress_bind_attrs = true,
|
2010-11-26 12:06:39 +00:00
|
|
|
},
|
|
|
|
.probe = ab8500_debug_probe,
|
2010-09-13 14:05:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static int __init ab8500_debug_init(void)
|
|
|
|
{
|
2010-11-26 12:06:39 +00:00
|
|
|
return platform_driver_register(&ab8500_debug_driver);
|
2010-09-13 14:05:04 +00:00
|
|
|
}
|
|
|
|
subsys_initcall(ab8500_debug_init);
|