diff options
Diffstat (limited to 'drivers/mfd/ab8500-debugfs.c')
-rw-r--r-- | drivers/mfd/ab8500-debugfs.c | 308 |
1 files changed, 181 insertions, 127 deletions
diff --git a/drivers/mfd/ab8500-debugfs.c b/drivers/mfd/ab8500-debugfs.c index d1a22aae2df5..b2c7e3b1edfa 100644 --- a/drivers/mfd/ab8500-debugfs.c +++ b/drivers/mfd/ab8500-debugfs.c | |||
@@ -135,10 +135,10 @@ struct ab8500_prcmu_ranges { | |||
135 | /* hwreg- "mask" and "shift" entries ressources */ | 135 | /* hwreg- "mask" and "shift" entries ressources */ |
136 | struct hwreg_cfg { | 136 | struct hwreg_cfg { |
137 | u32 bank; /* target bank */ | 137 | u32 bank; /* target bank */ |
138 | u32 addr; /* target address */ | 138 | unsigned long addr; /* target address */ |
139 | uint fmt; /* format */ | 139 | uint fmt; /* format */ |
140 | uint mask; /* read/write mask, applied before any bit shift */ | 140 | unsigned long mask; /* read/write mask, applied before any bit shift */ |
141 | int shift; /* bit shift (read:right shift, write:left shift */ | 141 | long shift; /* bit shift (read:right shift, write:left shift */ |
142 | }; | 142 | }; |
143 | /* fmt bit #0: 0=hexa, 1=dec */ | 143 | /* fmt bit #0: 0=hexa, 1=dec */ |
144 | #define REG_FMT_DEC(c) ((c)->fmt & 0x1) | 144 | #define REG_FMT_DEC(c) ((c)->fmt & 0x1) |
@@ -1304,16 +1304,17 @@ static int ab8500_registers_print(struct device *dev, u32 bank, | |||
1304 | } | 1304 | } |
1305 | 1305 | ||
1306 | if (s) { | 1306 | if (s) { |
1307 | err = seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n", | 1307 | err = seq_printf(s, |
1308 | bank, reg, value); | 1308 | " [0x%02X/0x%02X]: 0x%02X\n", |
1309 | bank, reg, value); | ||
1309 | if (err < 0) { | 1310 | if (err < 0) { |
1310 | /* Error is not returned here since | 1311 | /* Error is not returned here since |
1311 | * the output is wanted in any case */ | 1312 | * the output is wanted in any case */ |
1312 | return 0; | 1313 | return 0; |
1313 | } | 1314 | } |
1314 | } else { | 1315 | } else { |
1315 | printk(KERN_INFO" [0x%02X/0x%02X]: 0x%02X\n", | 1316 | dev_info(dev, " [0x%02X/0x%02X]: 0x%02X\n", |
1316 | bank, reg, value); | 1317 | bank, reg, value); |
1317 | } | 1318 | } |
1318 | } | 1319 | } |
1319 | } | 1320 | } |
@@ -1325,7 +1326,7 @@ static int ab8500_print_bank_registers(struct seq_file *s, void *p) | |||
1325 | struct device *dev = s->private; | 1326 | struct device *dev = s->private; |
1326 | u32 bank = debug_bank; | 1327 | u32 bank = debug_bank; |
1327 | 1328 | ||
1328 | seq_printf(s, AB8500_NAME_STRING " register values:\n"); | 1329 | seq_puts(s, AB8500_NAME_STRING " register values:\n"); |
1329 | 1330 | ||
1330 | seq_printf(s, " bank 0x%02X:\n", bank); | 1331 | seq_printf(s, " bank 0x%02X:\n", bank); |
1331 | 1332 | ||
@@ -1350,12 +1351,11 @@ static int ab8500_print_all_banks(struct seq_file *s, void *p) | |||
1350 | { | 1351 | { |
1351 | struct device *dev = s->private; | 1352 | struct device *dev = s->private; |
1352 | unsigned int i; | 1353 | unsigned int i; |
1353 | int err; | ||
1354 | 1354 | ||
1355 | seq_printf(s, AB8500_NAME_STRING " register values:\n"); | 1355 | seq_puts(s, AB8500_NAME_STRING " register values:\n"); |
1356 | 1356 | ||
1357 | for (i = 0; i < AB8500_NUM_BANKS; i++) { | 1357 | for (i = 0; i < AB8500_NUM_BANKS; i++) { |
1358 | err = seq_printf(s, " bank 0x%02X:\n", i); | 1358 | seq_printf(s, " bank 0x%02X:\n", i); |
1359 | 1359 | ||
1360 | ab8500_registers_print(dev, i, s); | 1360 | ab8500_registers_print(dev, i, s); |
1361 | } | 1361 | } |
@@ -1367,10 +1367,10 @@ void ab8500_dump_all_banks(struct device *dev) | |||
1367 | { | 1367 | { |
1368 | unsigned int i; | 1368 | unsigned int i; |
1369 | 1369 | ||
1370 | printk(KERN_INFO"ab8500 register values:\n"); | 1370 | dev_info(dev, "ab8500 register values:\n"); |
1371 | 1371 | ||
1372 | for (i = 1; i < AB8500_NUM_BANKS; i++) { | 1372 | for (i = 1; i < AB8500_NUM_BANKS; i++) { |
1373 | printk(KERN_INFO" bank 0x%02X:\n", i); | 1373 | dev_info(dev, " bank 0x%02X:\n", i); |
1374 | ab8500_registers_print(dev, i, NULL); | 1374 | ab8500_registers_print(dev, i, NULL); |
1375 | } | 1375 | } |
1376 | } | 1376 | } |
@@ -1384,8 +1384,6 @@ static struct ab8500_register_dump | |||
1384 | u8 value; | 1384 | u8 value; |
1385 | } ab8500_complete_register_dump[DUMP_MAX_REGS]; | 1385 | } ab8500_complete_register_dump[DUMP_MAX_REGS]; |
1386 | 1386 | ||
1387 | extern int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); | ||
1388 | |||
1389 | /* This shall only be called upon kernel panic! */ | 1387 | /* This shall only be called upon kernel panic! */ |
1390 | void ab8500_dump_all_banks_to_mem(void) | 1388 | void ab8500_dump_all_banks_to_mem(void) |
1391 | { | 1389 | { |
@@ -1393,8 +1391,7 @@ void ab8500_dump_all_banks_to_mem(void) | |||
1393 | u8 bank; | 1391 | u8 bank; |
1394 | int err = 0; | 1392 | int err = 0; |
1395 | 1393 | ||
1396 | pr_info("Saving all ABB registers at \"ab8500_complete_register_dump\" " | 1394 | pr_info("Saving all ABB registers for crash analysis.\n"); |
1397 | "for crash analyze.\n"); | ||
1398 | 1395 | ||
1399 | for (bank = 0; bank < AB8500_NUM_BANKS; bank++) { | 1396 | for (bank = 0; bank < AB8500_NUM_BANKS; bank++) { |
1400 | for (i = 0; i < debug_ranges[bank].num_ranges; i++) { | 1397 | for (i = 0; i < debug_ranges[bank].num_ranges; i++) { |
@@ -1564,7 +1561,7 @@ static ssize_t ab8500_val_write(struct file *file, | |||
1564 | err = abx500_set_register_interruptible(dev, | 1561 | err = abx500_set_register_interruptible(dev, |
1565 | (u8)debug_bank, debug_address, (u8)user_val); | 1562 | (u8)debug_bank, debug_address, (u8)user_val); |
1566 | if (err < 0) { | 1563 | if (err < 0) { |
1567 | printk(KERN_ERR "abx500_set_reg failed %d, %d", err, __LINE__); | 1564 | pr_err("abx500_set_reg failed %d, %d", err, __LINE__); |
1568 | return -EINVAL; | 1565 | return -EINVAL; |
1569 | } | 1566 | } |
1570 | 1567 | ||
@@ -1596,7 +1593,7 @@ static int ab8500_interrupts_print(struct seq_file *s, void *p) | |||
1596 | { | 1593 | { |
1597 | int line; | 1594 | int line; |
1598 | 1595 | ||
1599 | seq_printf(s, "name: number: number of: wake:\n"); | 1596 | seq_puts(s, "name: number: number of: wake:\n"); |
1600 | 1597 | ||
1601 | for (line = 0; line < num_interrupt_lines; line++) { | 1598 | for (line = 0; line < num_interrupt_lines; line++) { |
1602 | struct irq_desc *desc = irq_to_desc(line + irq_first); | 1599 | struct irq_desc *desc = irq_to_desc(line + irq_first); |
@@ -1722,7 +1719,8 @@ static int ab8500_print_modem_registers(struct seq_file *s, void *p) | |||
1722 | 1719 | ||
1723 | static int ab8500_modem_open(struct inode *inode, struct file *file) | 1720 | static int ab8500_modem_open(struct inode *inode, struct file *file) |
1724 | { | 1721 | { |
1725 | return single_open(file, ab8500_print_modem_registers, inode->i_private); | 1722 | return single_open(file, ab8500_print_modem_registers, |
1723 | inode->i_private); | ||
1726 | } | 1724 | } |
1727 | 1725 | ||
1728 | static const struct file_operations ab8500_modem_fops = { | 1726 | static const struct file_operations ab8500_modem_fops = { |
@@ -1751,7 +1749,8 @@ static int ab8500_gpadc_bat_ctrl_print(struct seq_file *s, void *p) | |||
1751 | 1749 | ||
1752 | static int ab8500_gpadc_bat_ctrl_open(struct inode *inode, struct file *file) | 1750 | static int ab8500_gpadc_bat_ctrl_open(struct inode *inode, struct file *file) |
1753 | { | 1751 | { |
1754 | return single_open(file, ab8500_gpadc_bat_ctrl_print, inode->i_private); | 1752 | return single_open(file, ab8500_gpadc_bat_ctrl_print, |
1753 | inode->i_private); | ||
1755 | } | 1754 | } |
1756 | 1755 | ||
1757 | static const struct file_operations ab8500_gpadc_bat_ctrl_fops = { | 1756 | static const struct file_operations ab8500_gpadc_bat_ctrl_fops = { |
@@ -1781,7 +1780,8 @@ static int ab8500_gpadc_btemp_ball_print(struct seq_file *s, void *p) | |||
1781 | static int ab8500_gpadc_btemp_ball_open(struct inode *inode, | 1780 | static int ab8500_gpadc_btemp_ball_open(struct inode *inode, |
1782 | struct file *file) | 1781 | struct file *file) |
1783 | { | 1782 | { |
1784 | return single_open(file, ab8500_gpadc_btemp_ball_print, inode->i_private); | 1783 | return single_open(file, ab8500_gpadc_btemp_ball_print, |
1784 | inode->i_private); | ||
1785 | } | 1785 | } |
1786 | 1786 | ||
1787 | static const struct file_operations ab8500_gpadc_btemp_ball_fops = { | 1787 | static const struct file_operations ab8500_gpadc_btemp_ball_fops = { |
@@ -1962,7 +1962,8 @@ static int ab8500_gpadc_main_bat_v_print(struct seq_file *s, void *p) | |||
1962 | static int ab8500_gpadc_main_bat_v_open(struct inode *inode, | 1962 | static int ab8500_gpadc_main_bat_v_open(struct inode *inode, |
1963 | struct file *file) | 1963 | struct file *file) |
1964 | { | 1964 | { |
1965 | return single_open(file, ab8500_gpadc_main_bat_v_print, inode->i_private); | 1965 | return single_open(file, ab8500_gpadc_main_bat_v_print, |
1966 | inode->i_private); | ||
1966 | } | 1967 | } |
1967 | 1968 | ||
1968 | static const struct file_operations ab8500_gpadc_main_bat_v_fops = { | 1969 | static const struct file_operations ab8500_gpadc_main_bat_v_fops = { |
@@ -2082,7 +2083,8 @@ static int ab8500_gpadc_bk_bat_v_print(struct seq_file *s, void *p) | |||
2082 | 2083 | ||
2083 | static int ab8500_gpadc_bk_bat_v_open(struct inode *inode, struct file *file) | 2084 | static int ab8500_gpadc_bk_bat_v_open(struct inode *inode, struct file *file) |
2084 | { | 2085 | { |
2085 | return single_open(file, ab8500_gpadc_bk_bat_v_print, inode->i_private); | 2086 | return single_open(file, ab8500_gpadc_bk_bat_v_print, |
2087 | inode->i_private); | ||
2086 | } | 2088 | } |
2087 | 2089 | ||
2088 | static const struct file_operations ab8500_gpadc_bk_bat_v_fops = { | 2090 | static const struct file_operations ab8500_gpadc_bk_bat_v_fops = { |
@@ -2111,7 +2113,8 @@ static int ab8500_gpadc_die_temp_print(struct seq_file *s, void *p) | |||
2111 | 2113 | ||
2112 | static int ab8500_gpadc_die_temp_open(struct inode *inode, struct file *file) | 2114 | static int ab8500_gpadc_die_temp_open(struct inode *inode, struct file *file) |
2113 | { | 2115 | { |
2114 | return single_open(file, ab8500_gpadc_die_temp_print, inode->i_private); | 2116 | return single_open(file, ab8500_gpadc_die_temp_print, |
2117 | inode->i_private); | ||
2115 | } | 2118 | } |
2116 | 2119 | ||
2117 | static const struct file_operations ab8500_gpadc_die_temp_fops = { | 2120 | static const struct file_operations ab8500_gpadc_die_temp_fops = { |
@@ -2190,8 +2193,9 @@ static int ab8540_gpadc_vbat_true_meas_print(struct seq_file *s, void *p) | |||
2190 | gpadc = ab8500_gpadc_get("ab8500-gpadc.0"); | 2193 | gpadc = ab8500_gpadc_get("ab8500-gpadc.0"); |
2191 | vbat_true_meas_raw = ab8500_gpadc_read_raw(gpadc, VBAT_TRUE_MEAS, | 2194 | vbat_true_meas_raw = ab8500_gpadc_read_raw(gpadc, VBAT_TRUE_MEAS, |
2192 | avg_sample, trig_edge, trig_timer, conv_type); | 2195 | avg_sample, trig_edge, trig_timer, conv_type); |
2193 | vbat_true_meas_convert = ab8500_gpadc_ad_to_voltage(gpadc, VBAT_TRUE_MEAS, | 2196 | vbat_true_meas_convert = |
2194 | vbat_true_meas_raw); | 2197 | ab8500_gpadc_ad_to_voltage(gpadc, VBAT_TRUE_MEAS, |
2198 | vbat_true_meas_raw); | ||
2195 | 2199 | ||
2196 | return seq_printf(s, "%d,0x%X\n", | 2200 | return seq_printf(s, "%d,0x%X\n", |
2197 | vbat_true_meas_convert, vbat_true_meas_raw); | 2201 | vbat_true_meas_convert, vbat_true_meas_raw); |
@@ -2285,7 +2289,8 @@ static const struct file_operations ab8540_gpadc_vbat_meas_and_ibat_fops = { | |||
2285 | .owner = THIS_MODULE, | 2289 | .owner = THIS_MODULE, |
2286 | }; | 2290 | }; |
2287 | 2291 | ||
2288 | static int ab8540_gpadc_vbat_true_meas_and_ibat_print(struct seq_file *s, void *p) | 2292 | static int ab8540_gpadc_vbat_true_meas_and_ibat_print(struct seq_file *s, |
2293 | void *p) | ||
2289 | { | 2294 | { |
2290 | int vbat_true_meas_raw; | 2295 | int vbat_true_meas_raw; |
2291 | int vbat_true_meas_convert; | 2296 | int vbat_true_meas_convert; |
@@ -2314,7 +2319,8 @@ static int ab8540_gpadc_vbat_true_meas_and_ibat_open(struct inode *inode, | |||
2314 | inode->i_private); | 2319 | inode->i_private); |
2315 | } | 2320 | } |
2316 | 2321 | ||
2317 | static const struct file_operations ab8540_gpadc_vbat_true_meas_and_ibat_fops = { | 2322 | static const struct file_operations |
2323 | ab8540_gpadc_vbat_true_meas_and_ibat_fops = { | ||
2318 | .open = ab8540_gpadc_vbat_true_meas_and_ibat_open, | 2324 | .open = ab8540_gpadc_vbat_true_meas_and_ibat_open, |
2319 | .read = seq_read, | 2325 | .read = seq_read, |
2320 | .llseek = seq_lseek, | 2326 | .llseek = seq_lseek, |
@@ -2368,14 +2374,15 @@ static int ab8540_gpadc_otp_cal_print(struct seq_file *s, void *p) | |||
2368 | ab8540_gpadc_get_otp(gpadc, &vmain_l, &vmain_h, &btemp_l, &btemp_h, | 2374 | ab8540_gpadc_get_otp(gpadc, &vmain_l, &vmain_h, &btemp_l, &btemp_h, |
2369 | &vbat_l, &vbat_h, &ibat_l, &ibat_h); | 2375 | &vbat_l, &vbat_h, &ibat_l, &ibat_h); |
2370 | return seq_printf(s, "VMAIN_L:0x%X\n" | 2376 | return seq_printf(s, "VMAIN_L:0x%X\n" |
2371 | "VMAIN_H:0x%X\n" | 2377 | "VMAIN_H:0x%X\n" |
2372 | "BTEMP_L:0x%X\n" | 2378 | "BTEMP_L:0x%X\n" |
2373 | "BTEMP_H:0x%X\n" | 2379 | "BTEMP_H:0x%X\n" |
2374 | "VBAT_L:0x%X\n" | 2380 | "VBAT_L:0x%X\n" |
2375 | "VBAT_H:0x%X\n" | 2381 | "VBAT_H:0x%X\n" |
2376 | "IBAT_L:0x%X\n" | 2382 | "IBAT_L:0x%X\n" |
2377 | "IBAT_H:0x%X\n", | 2383 | "IBAT_H:0x%X\n", |
2378 | vmain_l, vmain_h, btemp_l, btemp_h, vbat_l, vbat_h, ibat_l, ibat_h); | 2384 | vmain_l, vmain_h, btemp_l, btemp_h, |
2385 | vbat_l, vbat_h, ibat_l, ibat_h); | ||
2379 | } | 2386 | } |
2380 | 2387 | ||
2381 | static int ab8540_gpadc_otp_cal_open(struct inode *inode, struct file *file) | 2388 | static int ab8540_gpadc_otp_cal_open(struct inode *inode, struct file *file) |
@@ -2419,8 +2426,8 @@ static ssize_t ab8500_gpadc_avg_sample_write(struct file *file, | |||
2419 | || (user_avg_sample == SAMPLE_16)) { | 2426 | || (user_avg_sample == SAMPLE_16)) { |
2420 | avg_sample = (u8) user_avg_sample; | 2427 | avg_sample = (u8) user_avg_sample; |
2421 | } else { | 2428 | } else { |
2422 | dev_err(dev, "debugfs error input: " | 2429 | dev_err(dev, |
2423 | "should be egal to 1, 4, 8 or 16\n"); | 2430 | "debugfs err input: should be egal to 1, 4, 8 or 16\n"); |
2424 | return -EINVAL; | 2431 | return -EINVAL; |
2425 | } | 2432 | } |
2426 | 2433 | ||
@@ -2504,14 +2511,14 @@ static ssize_t ab8500_gpadc_trig_timer_write(struct file *file, | |||
2504 | if (err) | 2511 | if (err) |
2505 | return err; | 2512 | return err; |
2506 | 2513 | ||
2507 | if ((user_trig_timer >= 0) && (user_trig_timer <= 255)) { | 2514 | if (user_trig_timer & ~0xFF) { |
2508 | trig_timer = (u8) user_trig_timer; | 2515 | dev_err(dev, |
2509 | } else { | 2516 | "debugfs error input: should be beetween 0 to 255\n"); |
2510 | dev_err(dev, "debugfs error input: " | ||
2511 | "should be beetween 0 to 255\n"); | ||
2512 | return -EINVAL; | 2517 | return -EINVAL; |
2513 | } | 2518 | } |
2514 | 2519 | ||
2520 | trig_timer = (u8) user_trig_timer; | ||
2521 | |||
2515 | return count; | 2522 | return count; |
2516 | } | 2523 | } |
2517 | 2524 | ||
@@ -2579,6 +2586,7 @@ static const struct file_operations ab8500_gpadc_conv_type_fops = { | |||
2579 | static int strval_len(char *b) | 2586 | static int strval_len(char *b) |
2580 | { | 2587 | { |
2581 | char *s = b; | 2588 | char *s = b; |
2589 | |||
2582 | if ((*s == '0') && ((*(s+1) == 'x') || (*(s+1) == 'X'))) { | 2590 | if ((*s == '0') && ((*(s+1) == 'x') || (*(s+1) == 'X'))) { |
2583 | s += 2; | 2591 | s += 2; |
2584 | for (; *s && (*s != ' ') && (*s != '\n'); s++) { | 2592 | for (; *s && (*s != ' ') && (*s != '\n'); s++) { |
@@ -2643,13 +2651,17 @@ static ssize_t hwreg_common_write(char *b, struct hwreg_cfg *cfg, | |||
2643 | b += (*(b+2) == ' ') ? 3 : 6; | 2651 | b += (*(b+2) == ' ') ? 3 : 6; |
2644 | if (strval_len(b) == 0) | 2652 | if (strval_len(b) == 0) |
2645 | return -EINVAL; | 2653 | return -EINVAL; |
2646 | loc.mask = simple_strtoul(b, &b, 0); | 2654 | ret = kstrtoul(b, 0, &loc.mask); |
2655 | if (ret) | ||
2656 | return ret; | ||
2647 | } else if ((!strncmp(b, "-s ", 3)) || | 2657 | } else if ((!strncmp(b, "-s ", 3)) || |
2648 | (!strncmp(b, "-shift ", 7))) { | 2658 | (!strncmp(b, "-shift ", 7))) { |
2649 | b += (*(b+2) == ' ') ? 3 : 7; | 2659 | b += (*(b+2) == ' ') ? 3 : 7; |
2650 | if (strval_len(b) == 0) | 2660 | if (strval_len(b) == 0) |
2651 | return -EINVAL; | 2661 | return -EINVAL; |
2652 | loc.shift = simple_strtol(b, &b, 0); | 2662 | ret = kstrtol(b, 0, &loc.shift); |
2663 | if (ret) | ||
2664 | return ret; | ||
2653 | } else { | 2665 | } else { |
2654 | return -EINVAL; | 2666 | return -EINVAL; |
2655 | } | 2667 | } |
@@ -2657,29 +2669,36 @@ static ssize_t hwreg_common_write(char *b, struct hwreg_cfg *cfg, | |||
2657 | /* get arg BANK and ADDRESS */ | 2669 | /* get arg BANK and ADDRESS */ |
2658 | if (strval_len(b) == 0) | 2670 | if (strval_len(b) == 0) |
2659 | return -EINVAL; | 2671 | return -EINVAL; |
2660 | loc.bank = simple_strtoul(b, &b, 0); | 2672 | ret = kstrtouint(b, 0, &loc.bank); |
2673 | if (ret) | ||
2674 | return ret; | ||
2661 | while (*b == ' ') | 2675 | while (*b == ' ') |
2662 | b++; | 2676 | b++; |
2663 | if (strval_len(b) == 0) | 2677 | if (strval_len(b) == 0) |
2664 | return -EINVAL; | 2678 | return -EINVAL; |
2665 | loc.addr = simple_strtoul(b, &b, 0); | 2679 | ret = kstrtoul(b, 0, &loc.addr); |
2680 | if (ret) | ||
2681 | return ret; | ||
2666 | 2682 | ||
2667 | if (write) { | 2683 | if (write) { |
2668 | while (*b == ' ') | 2684 | while (*b == ' ') |
2669 | b++; | 2685 | b++; |
2670 | if (strval_len(b) == 0) | 2686 | if (strval_len(b) == 0) |
2671 | return -EINVAL; | 2687 | return -EINVAL; |
2672 | val = simple_strtoul(b, &b, 0); | 2688 | ret = kstrtouint(b, 0, &val); |
2689 | if (ret) | ||
2690 | return ret; | ||
2673 | } | 2691 | } |
2674 | 2692 | ||
2675 | /* args are ok, update target cfg (mainly for read) */ | 2693 | /* args are ok, update target cfg (mainly for read) */ |
2676 | *cfg = loc; | 2694 | *cfg = loc; |
2677 | 2695 | ||
2678 | #ifdef ABB_HWREG_DEBUG | 2696 | #ifdef ABB_HWREG_DEBUG |
2679 | pr_warn("HWREG request: %s, %s, addr=0x%08X, mask=0x%X, shift=%d" | 2697 | pr_warn("HWREG request: %s, %s,\n" |
2680 | "value=0x%X\n", (write) ? "write" : "read", | 2698 | " addr=0x%08X, mask=0x%X, shift=%d" "value=0x%X\n", |
2681 | REG_FMT_DEC(cfg) ? "decimal" : "hexa", | 2699 | (write) ? "write" : "read", |
2682 | cfg->addr, cfg->mask, cfg->shift, val); | 2700 | REG_FMT_DEC(cfg) ? "decimal" : "hexa", |
2701 | cfg->addr, cfg->mask, cfg->shift, val); | ||
2683 | #endif | 2702 | #endif |
2684 | 2703 | ||
2685 | if (!write) | 2704 | if (!write) |
@@ -2765,8 +2784,8 @@ static ssize_t show_irq(struct device *dev, | |||
2765 | irq_index = name - irq_first; | 2784 | irq_index = name - irq_first; |
2766 | if (irq_index >= num_irqs) | 2785 | if (irq_index >= num_irqs) |
2767 | return -EINVAL; | 2786 | return -EINVAL; |
2768 | else | 2787 | |
2769 | return sprintf(buf, "%u\n", irq_count[irq_index]); | 2788 | return sprintf(buf, "%u\n", irq_count[irq_index]); |
2770 | } | 2789 | } |
2771 | 2790 | ||
2772 | static ssize_t ab8500_subscribe_write(struct file *file, | 2791 | static ssize_t ab8500_subscribe_write(struct file *file, |
@@ -2815,7 +2834,7 @@ static ssize_t ab8500_subscribe_write(struct file *file, | |||
2815 | dev_attr[irq_index]->attr.mode = S_IRUGO; | 2834 | dev_attr[irq_index]->attr.mode = S_IRUGO; |
2816 | err = sysfs_create_file(&dev->kobj, &dev_attr[irq_index]->attr); | 2835 | err = sysfs_create_file(&dev->kobj, &dev_attr[irq_index]->attr); |
2817 | if (err < 0) { | 2836 | if (err < 0) { |
2818 | printk(KERN_ERR "sysfs_create_file failed %d\n", err); | 2837 | pr_info("sysfs_create_file failed %d\n", err); |
2819 | return err; | 2838 | return err; |
2820 | } | 2839 | } |
2821 | 2840 | ||
@@ -2823,8 +2842,8 @@ static ssize_t ab8500_subscribe_write(struct file *file, | |||
2823 | IRQF_SHARED | IRQF_NO_SUSPEND, | 2842 | IRQF_SHARED | IRQF_NO_SUSPEND, |
2824 | "ab8500-debug", &dev->kobj); | 2843 | "ab8500-debug", &dev->kobj); |
2825 | if (err < 0) { | 2844 | if (err < 0) { |
2826 | printk(KERN_ERR "request_threaded_irq failed %d, %lu\n", | 2845 | pr_info("request_threaded_irq failed %d, %lu\n", |
2827 | err, user_val); | 2846 | err, user_val); |
2828 | sysfs_remove_file(&dev->kobj, &dev_attr[irq_index]->attr); | 2847 | sysfs_remove_file(&dev->kobj, &dev_attr[irq_index]->attr); |
2829 | return err; | 2848 | return err; |
2830 | } | 2849 | } |
@@ -2946,6 +2965,7 @@ static int ab8500_debug_probe(struct platform_device *plf) | |||
2946 | struct dentry *file; | 2965 | struct dentry *file; |
2947 | struct ab8500 *ab8500; | 2966 | struct ab8500 *ab8500; |
2948 | struct resource *res; | 2967 | struct resource *res; |
2968 | |||
2949 | debug_bank = AB8500_MISC; | 2969 | debug_bank = AB8500_MISC; |
2950 | debug_address = AB8500_REV_REG & 0x00FF; | 2970 | debug_address = AB8500_REV_REG & 0x00FF; |
2951 | 2971 | ||
@@ -2958,7 +2978,7 @@ static int ab8500_debug_probe(struct platform_device *plf) | |||
2958 | return -ENOMEM; | 2978 | return -ENOMEM; |
2959 | 2979 | ||
2960 | dev_attr = devm_kzalloc(&plf->dev, | 2980 | dev_attr = devm_kzalloc(&plf->dev, |
2961 | sizeof(*dev_attr)*num_irqs,GFP_KERNEL); | 2981 | sizeof(*dev_attr)*num_irqs, GFP_KERNEL); |
2962 | if (!dev_attr) | 2982 | if (!dev_attr) |
2963 | return -ENOMEM; | 2983 | return -ENOMEM; |
2964 | 2984 | ||
@@ -2969,23 +2989,20 @@ static int ab8500_debug_probe(struct platform_device *plf) | |||
2969 | 2989 | ||
2970 | res = platform_get_resource_byname(plf, 0, "IRQ_AB8500"); | 2990 | res = platform_get_resource_byname(plf, 0, "IRQ_AB8500"); |
2971 | if (!res) { | 2991 | if (!res) { |
2972 | dev_err(&plf->dev, "AB8500 irq not found, err %d\n", | 2992 | dev_err(&plf->dev, "AB8500 irq not found, err %d\n", irq_first); |
2973 | irq_first); | 2993 | return -ENXIO; |
2974 | return ENXIO; | ||
2975 | } | 2994 | } |
2976 | irq_ab8500 = res->start; | 2995 | irq_ab8500 = res->start; |
2977 | 2996 | ||
2978 | irq_first = platform_get_irq_byname(plf, "IRQ_FIRST"); | 2997 | irq_first = platform_get_irq_byname(plf, "IRQ_FIRST"); |
2979 | if (irq_first < 0) { | 2998 | if (irq_first < 0) { |
2980 | dev_err(&plf->dev, "First irq not found, err %d\n", | 2999 | dev_err(&plf->dev, "First irq not found, err %d\n", irq_first); |
2981 | irq_first); | ||
2982 | return irq_first; | 3000 | return irq_first; |
2983 | } | 3001 | } |
2984 | 3002 | ||
2985 | irq_last = platform_get_irq_byname(plf, "IRQ_LAST"); | 3003 | irq_last = platform_get_irq_byname(plf, "IRQ_LAST"); |
2986 | if (irq_last < 0) { | 3004 | if (irq_last < 0) { |
2987 | dev_err(&plf->dev, "Last irq not found, err %d\n", | 3005 | dev_err(&plf->dev, "Last irq not found, err %d\n", irq_last); |
2988 | irq_last); | ||
2989 | return irq_last; | 3006 | return irq_last; |
2990 | } | 3007 | } |
2991 | 3008 | ||
@@ -2994,37 +3011,41 @@ static int ab8500_debug_probe(struct platform_device *plf) | |||
2994 | goto err; | 3011 | goto err; |
2995 | 3012 | ||
2996 | ab8500_gpadc_dir = debugfs_create_dir(AB8500_ADC_NAME_STRING, | 3013 | ab8500_gpadc_dir = debugfs_create_dir(AB8500_ADC_NAME_STRING, |
2997 | ab8500_dir); | 3014 | ab8500_dir); |
2998 | if (!ab8500_gpadc_dir) | 3015 | if (!ab8500_gpadc_dir) |
2999 | goto err; | 3016 | goto err; |
3000 | 3017 | ||
3001 | file = debugfs_create_file("all-bank-registers", S_IRUGO, | 3018 | file = debugfs_create_file("all-bank-registers", S_IRUGO, ab8500_dir, |
3002 | ab8500_dir, &plf->dev, &ab8500_registers_fops); | 3019 | &plf->dev, &ab8500_registers_fops); |
3003 | if (!file) | 3020 | if (!file) |
3004 | goto err; | 3021 | goto err; |
3005 | 3022 | ||
3006 | file = debugfs_create_file("all-banks", S_IRUGO, | 3023 | file = debugfs_create_file("all-banks", S_IRUGO, ab8500_dir, |
3007 | ab8500_dir, &plf->dev, &ab8500_all_banks_fops); | 3024 | &plf->dev, &ab8500_all_banks_fops); |
3008 | if (!file) | 3025 | if (!file) |
3009 | goto err; | 3026 | goto err; |
3010 | 3027 | ||
3011 | file = debugfs_create_file("register-bank", (S_IRUGO | S_IWUSR | S_IWGRP), | 3028 | file = debugfs_create_file("register-bank", |
3012 | ab8500_dir, &plf->dev, &ab8500_bank_fops); | 3029 | (S_IRUGO | S_IWUSR | S_IWGRP), |
3030 | ab8500_dir, &plf->dev, &ab8500_bank_fops); | ||
3013 | if (!file) | 3031 | if (!file) |
3014 | goto err; | 3032 | goto err; |
3015 | 3033 | ||
3016 | file = debugfs_create_file("register-address", (S_IRUGO | S_IWUSR | S_IWGRP), | 3034 | file = debugfs_create_file("register-address", |
3017 | ab8500_dir, &plf->dev, &ab8500_address_fops); | 3035 | (S_IRUGO | S_IWUSR | S_IWGRP), |
3036 | ab8500_dir, &plf->dev, &ab8500_address_fops); | ||
3018 | if (!file) | 3037 | if (!file) |
3019 | goto err; | 3038 | goto err; |
3020 | 3039 | ||
3021 | file = debugfs_create_file("register-value", (S_IRUGO | S_IWUSR | S_IWGRP), | 3040 | file = debugfs_create_file("register-value", |
3022 | ab8500_dir, &plf->dev, &ab8500_val_fops); | 3041 | (S_IRUGO | S_IWUSR | S_IWGRP), |
3042 | ab8500_dir, &plf->dev, &ab8500_val_fops); | ||
3023 | if (!file) | 3043 | if (!file) |
3024 | goto err; | 3044 | goto err; |
3025 | 3045 | ||
3026 | file = debugfs_create_file("irq-subscribe", (S_IRUGO | S_IWUSR | S_IWGRP), | 3046 | file = debugfs_create_file("irq-subscribe", |
3027 | ab8500_dir, &plf->dev, &ab8500_subscribe_fops); | 3047 | (S_IRUGO | S_IWUSR | S_IWGRP), ab8500_dir, |
3048 | &plf->dev, &ab8500_subscribe_fops); | ||
3028 | if (!file) | 3049 | if (!file) |
3029 | goto err; | 3050 | goto err; |
3030 | 3051 | ||
@@ -3042,158 +3063,191 @@ static int ab8500_debug_probe(struct platform_device *plf) | |||
3042 | num_interrupt_lines = AB8540_NR_IRQS; | 3063 | num_interrupt_lines = AB8540_NR_IRQS; |
3043 | } | 3064 | } |
3044 | 3065 | ||
3045 | file = debugfs_create_file("interrupts", (S_IRUGO), | 3066 | file = debugfs_create_file("interrupts", (S_IRUGO), ab8500_dir, |
3046 | ab8500_dir, &plf->dev, &ab8500_interrupts_fops); | 3067 | &plf->dev, &ab8500_interrupts_fops); |
3047 | if (!file) | 3068 | if (!file) |
3048 | goto err; | 3069 | goto err; |
3049 | 3070 | ||
3050 | file = debugfs_create_file("irq-unsubscribe", (S_IRUGO | S_IWUSR | S_IWGRP), | 3071 | file = debugfs_create_file("irq-unsubscribe", |
3051 | ab8500_dir, &plf->dev, &ab8500_unsubscribe_fops); | 3072 | (S_IRUGO | S_IWUSR | S_IWGRP), ab8500_dir, |
3073 | &plf->dev, &ab8500_unsubscribe_fops); | ||
3052 | if (!file) | 3074 | if (!file) |
3053 | goto err; | 3075 | goto err; |
3054 | 3076 | ||
3055 | file = debugfs_create_file("hwreg", (S_IRUGO | S_IWUSR | S_IWGRP), | 3077 | file = debugfs_create_file("hwreg", (S_IRUGO | S_IWUSR | S_IWGRP), |
3056 | ab8500_dir, &plf->dev, &ab8500_hwreg_fops); | 3078 | ab8500_dir, &plf->dev, &ab8500_hwreg_fops); |
3057 | if (!file) | 3079 | if (!file) |
3058 | goto err; | 3080 | goto err; |
3059 | 3081 | ||
3060 | file = debugfs_create_file("all-modem-registers", (S_IRUGO | S_IWUSR | S_IWGRP), | 3082 | file = debugfs_create_file("all-modem-registers", |
3061 | ab8500_dir, &plf->dev, &ab8500_modem_fops); | 3083 | (S_IRUGO | S_IWUSR | S_IWGRP), |
3084 | ab8500_dir, &plf->dev, &ab8500_modem_fops); | ||
3062 | if (!file) | 3085 | if (!file) |
3063 | goto err; | 3086 | goto err; |
3064 | 3087 | ||
3065 | file = debugfs_create_file("bat_ctrl", (S_IRUGO | S_IWUSR | S_IWGRP), | 3088 | file = debugfs_create_file("bat_ctrl", (S_IRUGO | S_IWUSR | S_IWGRP), |
3066 | ab8500_gpadc_dir, &plf->dev, &ab8500_gpadc_bat_ctrl_fops); | 3089 | ab8500_gpadc_dir, &plf->dev, |
3090 | &ab8500_gpadc_bat_ctrl_fops); | ||
3067 | if (!file) | 3091 | if (!file) |
3068 | goto err; | 3092 | goto err; |
3069 | 3093 | ||
3070 | file = debugfs_create_file("btemp_ball", (S_IRUGO | S_IWUSR | S_IWGRP), | 3094 | file = debugfs_create_file("btemp_ball", (S_IRUGO | S_IWUSR | S_IWGRP), |
3071 | ab8500_gpadc_dir, &plf->dev, &ab8500_gpadc_btemp_ball_fops); | 3095 | ab8500_gpadc_dir, |
3096 | &plf->dev, &ab8500_gpadc_btemp_ball_fops); | ||
3072 | if (!file) | 3097 | if (!file) |
3073 | goto err; | 3098 | goto err; |
3074 | 3099 | ||
3075 | file = debugfs_create_file("main_charger_v", (S_IRUGO | S_IWUSR | S_IWGRP), | 3100 | file = debugfs_create_file("main_charger_v", |
3076 | ab8500_gpadc_dir, &plf->dev, &ab8500_gpadc_main_charger_v_fops); | 3101 | (S_IRUGO | S_IWUSR | S_IWGRP), |
3102 | ab8500_gpadc_dir, &plf->dev, | ||
3103 | &ab8500_gpadc_main_charger_v_fops); | ||
3077 | if (!file) | 3104 | if (!file) |
3078 | goto err; | 3105 | goto err; |
3079 | 3106 | ||
3080 | file = debugfs_create_file("acc_detect1", (S_IRUGO | S_IWUSR | S_IWGRP), | 3107 | file = debugfs_create_file("acc_detect1", |
3081 | ab8500_gpadc_dir, &plf->dev, &ab8500_gpadc_acc_detect1_fops); | 3108 | (S_IRUGO | S_IWUSR | S_IWGRP), |
3109 | ab8500_gpadc_dir, &plf->dev, | ||
3110 | &ab8500_gpadc_acc_detect1_fops); | ||
3082 | if (!file) | 3111 | if (!file) |
3083 | goto err; | 3112 | goto err; |
3084 | 3113 | ||
3085 | file = debugfs_create_file("acc_detect2", (S_IRUGO | S_IWUSR | S_IWGRP), | 3114 | file = debugfs_create_file("acc_detect2", |
3086 | ab8500_gpadc_dir, &plf->dev, &ab8500_gpadc_acc_detect2_fops); | 3115 | (S_IRUGO | S_IWUSR | S_IWGRP), |
3116 | ab8500_gpadc_dir, &plf->dev, | ||
3117 | &ab8500_gpadc_acc_detect2_fops); | ||
3087 | if (!file) | 3118 | if (!file) |
3088 | goto err; | 3119 | goto err; |
3089 | 3120 | ||
3090 | file = debugfs_create_file("adc_aux1", (S_IRUGO | S_IWUSR | S_IWGRP), | 3121 | file = debugfs_create_file("adc_aux1", (S_IRUGO | S_IWUSR | S_IWGRP), |
3091 | ab8500_gpadc_dir, &plf->dev, &ab8500_gpadc_aux1_fops); | 3122 | ab8500_gpadc_dir, &plf->dev, |
3123 | &ab8500_gpadc_aux1_fops); | ||
3092 | if (!file) | 3124 | if (!file) |
3093 | goto err; | 3125 | goto err; |
3094 | 3126 | ||
3095 | file = debugfs_create_file("adc_aux2", (S_IRUGO | S_IWUSR | S_IWGRP), | 3127 | file = debugfs_create_file("adc_aux2", (S_IRUGO | S_IWUSR | S_IWGRP), |
3096 | ab8500_gpadc_dir, &plf->dev, &ab8500_gpadc_aux2_fops); | 3128 | ab8500_gpadc_dir, &plf->dev, |
3129 | &ab8500_gpadc_aux2_fops); | ||
3097 | if (!file) | 3130 | if (!file) |
3098 | goto err; | 3131 | goto err; |
3099 | 3132 | ||
3100 | file = debugfs_create_file("main_bat_v", (S_IRUGO | S_IWUSR | S_IWGRP), | 3133 | file = debugfs_create_file("main_bat_v", (S_IRUGO | S_IWUSR | S_IWGRP), |
3101 | ab8500_gpadc_dir, &plf->dev, &ab8500_gpadc_main_bat_v_fops); | 3134 | ab8500_gpadc_dir, &plf->dev, |
3135 | &ab8500_gpadc_main_bat_v_fops); | ||
3102 | if (!file) | 3136 | if (!file) |
3103 | goto err; | 3137 | goto err; |
3104 | 3138 | ||
3105 | file = debugfs_create_file("vbus_v", (S_IRUGO | S_IWUSR | S_IWGRP), | 3139 | file = debugfs_create_file("vbus_v", (S_IRUGO | S_IWUSR | S_IWGRP), |
3106 | ab8500_gpadc_dir, &plf->dev, &ab8500_gpadc_vbus_v_fops); | 3140 | ab8500_gpadc_dir, &plf->dev, |
3141 | &ab8500_gpadc_vbus_v_fops); | ||
3107 | if (!file) | 3142 | if (!file) |
3108 | goto err; | 3143 | goto err; |
3109 | 3144 | ||
3110 | file = debugfs_create_file("main_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP), | 3145 | file = debugfs_create_file("main_charger_c", |
3111 | ab8500_gpadc_dir, &plf->dev, &ab8500_gpadc_main_charger_c_fops); | 3146 | (S_IRUGO | S_IWUSR | S_IWGRP), |
3147 | ab8500_gpadc_dir, &plf->dev, | ||
3148 | &ab8500_gpadc_main_charger_c_fops); | ||
3112 | if (!file) | 3149 | if (!file) |
3113 | goto err; | 3150 | goto err; |
3114 | 3151 | ||
3115 | file = debugfs_create_file("usb_charger_c", (S_IRUGO | S_IWUSR | S_IWGRP), | 3152 | file = debugfs_create_file("usb_charger_c", |
3116 | ab8500_gpadc_dir, &plf->dev, &ab8500_gpadc_usb_charger_c_fops); | 3153 | (S_IRUGO | S_IWUSR | S_IWGRP), |
3154 | ab8500_gpadc_dir, | ||
3155 | &plf->dev, &ab8500_gpadc_usb_charger_c_fops); | ||
3117 | if (!file) | 3156 | if (!file) |
3118 | goto err; | 3157 | goto err; |
3119 | 3158 | ||
3120 | file = debugfs_create_file("bk_bat_v", (S_IRUGO | S_IWUSR | S_IWGRP), | 3159 | file = debugfs_create_file("bk_bat_v", (S_IRUGO | S_IWUSR | S_IWGRP), |
3121 | ab8500_gpadc_dir, &plf->dev, &ab8500_gpadc_bk_bat_v_fops); | 3160 | ab8500_gpadc_dir, &plf->dev, |
3161 | &ab8500_gpadc_bk_bat_v_fops); | ||
3122 | if (!file) | 3162 | if (!file) |
3123 | goto err; | 3163 | goto err; |
3124 | 3164 | ||
3125 | file = debugfs_create_file("die_temp", (S_IRUGO | S_IWUSR | S_IWGRP), | 3165 | file = debugfs_create_file("die_temp", (S_IRUGO | S_IWUSR | S_IWGRP), |
3126 | ab8500_gpadc_dir, &plf->dev, &ab8500_gpadc_die_temp_fops); | 3166 | ab8500_gpadc_dir, &plf->dev, |
3167 | &ab8500_gpadc_die_temp_fops); | ||
3127 | if (!file) | 3168 | if (!file) |
3128 | goto err; | 3169 | goto err; |
3129 | 3170 | ||
3130 | file = debugfs_create_file("usb_id", (S_IRUGO | S_IWUSR | S_IWGRP), | 3171 | file = debugfs_create_file("usb_id", (S_IRUGO | S_IWUSR | S_IWGRP), |
3131 | ab8500_gpadc_dir, &plf->dev, &ab8500_gpadc_usb_id_fops); | 3172 | ab8500_gpadc_dir, &plf->dev, |
3173 | &ab8500_gpadc_usb_id_fops); | ||
3132 | if (!file) | 3174 | if (!file) |
3133 | goto err; | 3175 | goto err; |
3134 | 3176 | ||
3135 | if (is_ab8540(ab8500)) { | 3177 | if (is_ab8540(ab8500)) { |
3136 | file = debugfs_create_file("xtal_temp", (S_IRUGO | S_IWUSR | S_IWGRP), | 3178 | file = debugfs_create_file("xtal_temp", |
3137 | ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_xtal_temp_fops); | 3179 | (S_IRUGO | S_IWUSR | S_IWGRP), |
3180 | ab8500_gpadc_dir, &plf->dev, | ||
3181 | &ab8540_gpadc_xtal_temp_fops); | ||
3138 | if (!file) | 3182 | if (!file) |
3139 | goto err; | 3183 | goto err; |
3140 | file = debugfs_create_file("vbattruemeas", (S_IRUGO | S_IWUSR | S_IWGRP), | 3184 | file = debugfs_create_file("vbattruemeas", |
3141 | ab8500_gpadc_dir, &plf->dev, | 3185 | (S_IRUGO | S_IWUSR | S_IWGRP), |
3142 | &ab8540_gpadc_vbat_true_meas_fops); | 3186 | ab8500_gpadc_dir, &plf->dev, |
3187 | &ab8540_gpadc_vbat_true_meas_fops); | ||
3143 | if (!file) | 3188 | if (!file) |
3144 | goto err; | 3189 | goto err; |
3145 | file = debugfs_create_file("batctrl_and_ibat", | 3190 | file = debugfs_create_file("batctrl_and_ibat", |
3146 | (S_IRUGO | S_IWUGO), ab8500_gpadc_dir, | 3191 | (S_IRUGO | S_IWUGO), |
3147 | &plf->dev, &ab8540_gpadc_bat_ctrl_and_ibat_fops); | 3192 | ab8500_gpadc_dir, |
3193 | &plf->dev, | ||
3194 | &ab8540_gpadc_bat_ctrl_and_ibat_fops); | ||
3148 | if (!file) | 3195 | if (!file) |
3149 | goto err; | 3196 | goto err; |
3150 | file = debugfs_create_file("vbatmeas_and_ibat", | 3197 | file = debugfs_create_file("vbatmeas_and_ibat", |
3151 | (S_IRUGO | S_IWUGO), ab8500_gpadc_dir, | 3198 | (S_IRUGO | S_IWUGO), |
3152 | &plf->dev, | 3199 | ab8500_gpadc_dir, &plf->dev, |
3153 | &ab8540_gpadc_vbat_meas_and_ibat_fops); | 3200 | &ab8540_gpadc_vbat_meas_and_ibat_fops); |
3154 | if (!file) | 3201 | if (!file) |
3155 | goto err; | 3202 | goto err; |
3156 | file = debugfs_create_file("vbattruemeas_and_ibat", | 3203 | file = debugfs_create_file("vbattruemeas_and_ibat", |
3157 | (S_IRUGO | S_IWUGO), ab8500_gpadc_dir, | 3204 | (S_IRUGO | S_IWUGO), |
3158 | &plf->dev, | 3205 | ab8500_gpadc_dir, |
3159 | &ab8540_gpadc_vbat_true_meas_and_ibat_fops); | 3206 | &plf->dev, |
3207 | &ab8540_gpadc_vbat_true_meas_and_ibat_fops); | ||
3160 | if (!file) | 3208 | if (!file) |
3161 | goto err; | 3209 | goto err; |
3162 | file = debugfs_create_file("battemp_and_ibat", | 3210 | file = debugfs_create_file("battemp_and_ibat", |
3163 | (S_IRUGO | S_IWUGO), ab8500_gpadc_dir, | 3211 | (S_IRUGO | S_IWUGO), |
3212 | ab8500_gpadc_dir, | ||
3164 | &plf->dev, &ab8540_gpadc_bat_temp_and_ibat_fops); | 3213 | &plf->dev, &ab8540_gpadc_bat_temp_and_ibat_fops); |
3165 | if (!file) | 3214 | if (!file) |
3166 | goto err; | 3215 | goto err; |
3167 | file = debugfs_create_file("otp_calib", (S_IRUGO | S_IWUSR | S_IWGRP), | 3216 | file = debugfs_create_file("otp_calib", |
3168 | ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_otp_calib_fops); | 3217 | (S_IRUGO | S_IWUSR | S_IWGRP), |
3218 | ab8500_gpadc_dir, | ||
3219 | &plf->dev, &ab8540_gpadc_otp_calib_fops); | ||
3169 | if (!file) | 3220 | if (!file) |
3170 | goto err; | 3221 | goto err; |
3171 | } | 3222 | } |
3172 | file = debugfs_create_file("avg_sample", (S_IRUGO | S_IWUSR | S_IWGRP), | 3223 | file = debugfs_create_file("avg_sample", (S_IRUGO | S_IWUSR | S_IWGRP), |
3173 | ab8500_gpadc_dir, &plf->dev, &ab8500_gpadc_avg_sample_fops); | 3224 | ab8500_gpadc_dir, &plf->dev, |
3225 | &ab8500_gpadc_avg_sample_fops); | ||
3174 | if (!file) | 3226 | if (!file) |
3175 | goto err; | 3227 | goto err; |
3176 | 3228 | ||
3177 | file = debugfs_create_file("trig_edge", (S_IRUGO | S_IWUSR | S_IWGRP), | 3229 | file = debugfs_create_file("trig_edge", (S_IRUGO | S_IWUSR | S_IWGRP), |
3178 | ab8500_gpadc_dir, &plf->dev, &ab8500_gpadc_trig_edge_fops); | 3230 | ab8500_gpadc_dir, &plf->dev, |
3231 | &ab8500_gpadc_trig_edge_fops); | ||
3179 | if (!file) | 3232 | if (!file) |
3180 | goto err; | 3233 | goto err; |
3181 | 3234 | ||
3182 | file = debugfs_create_file("trig_timer", (S_IRUGO | S_IWUSR | S_IWGRP), | 3235 | file = debugfs_create_file("trig_timer", (S_IRUGO | S_IWUSR | S_IWGRP), |
3183 | ab8500_gpadc_dir, &plf->dev, &ab8500_gpadc_trig_timer_fops); | 3236 | ab8500_gpadc_dir, &plf->dev, |
3237 | &ab8500_gpadc_trig_timer_fops); | ||
3184 | if (!file) | 3238 | if (!file) |
3185 | goto err; | 3239 | goto err; |
3186 | 3240 | ||
3187 | file = debugfs_create_file("conv_type", (S_IRUGO | S_IWUSR | S_IWGRP), | 3241 | file = debugfs_create_file("conv_type", (S_IRUGO | S_IWUSR | S_IWGRP), |
3188 | ab8500_gpadc_dir, &plf->dev, &ab8500_gpadc_conv_type_fops); | 3242 | ab8500_gpadc_dir, &plf->dev, |
3243 | &ab8500_gpadc_conv_type_fops); | ||
3189 | if (!file) | 3244 | if (!file) |
3190 | goto err; | 3245 | goto err; |
3191 | 3246 | ||
3192 | return 0; | 3247 | return 0; |
3193 | 3248 | ||
3194 | err: | 3249 | err: |
3195 | if (ab8500_dir) | 3250 | debugfs_remove_recursive(ab8500_dir); |
3196 | debugfs_remove_recursive(ab8500_dir); | ||
3197 | dev_err(&plf->dev, "failed to create debugfs entries.\n"); | 3251 | dev_err(&plf->dev, "failed to create debugfs entries.\n"); |
3198 | 3252 | ||
3199 | return -ENOMEM; | 3253 | return -ENOMEM; |