aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2014-01-21 03:23:16 -0500
committerLee Jones <lee.jones@linaro.org>2014-01-21 03:23:16 -0500
commit6eb37eb276f0b91adb43b853ce6fb0812fbf0883 (patch)
treef57e6ddb20a498e57bdc2faf5136879519fda79e /drivers/mfd
parentac99a037bce3e6ae16d45ffb26eadbfc518fc143 (diff)
parent254dc326dbfd23c2678fafad1b84fc0e42ac4374 (diff)
Merge tag 'tags/ib-asoc-1' into for-mfd-next
Immutable branch for ASoC, as requested by Mark Brown
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/wm5110-tables.c73
1 files changed, 69 insertions, 4 deletions
diff --git a/drivers/mfd/wm5110-tables.c b/drivers/mfd/wm5110-tables.c
index d3d753179d65..8dc49ec3b246 100644
--- a/drivers/mfd/wm5110-tables.c
+++ b/drivers/mfd/wm5110-tables.c
@@ -14,6 +14,7 @@
14 14
15#include <linux/mfd/arizona/core.h> 15#include <linux/mfd/arizona/core.h>
16#include <linux/mfd/arizona/registers.h> 16#include <linux/mfd/arizona/registers.h>
17#include <linux/device.h>
17 18
18#include "arizona.h" 19#include "arizona.h"
19 20
@@ -524,6 +525,7 @@ static const struct reg_default wm5110_reg_default[] = {
524 { 0x00000300, 0x0000 }, /* R768 - Input Enables */ 525 { 0x00000300, 0x0000 }, /* R768 - Input Enables */
525 { 0x00000308, 0x0000 }, /* R776 - Input Rate */ 526 { 0x00000308, 0x0000 }, /* R776 - Input Rate */
526 { 0x00000309, 0x0022 }, /* R777 - Input Volume Ramp */ 527 { 0x00000309, 0x0022 }, /* R777 - Input Volume Ramp */
528 { 0x0000030C, 0x0002 }, /* R780 - HPF Control */
527 { 0x00000310, 0x2080 }, /* R784 - IN1L Control */ 529 { 0x00000310, 0x2080 }, /* R784 - IN1L Control */
528 { 0x00000311, 0x0180 }, /* R785 - ADC Digital Volume 1L */ 530 { 0x00000311, 0x0180 }, /* R785 - ADC Digital Volume 1L */
529 { 0x00000312, 0x0000 }, /* R786 - DMIC1L Control */ 531 { 0x00000312, 0x0000 }, /* R786 - DMIC1L Control */
@@ -545,6 +547,7 @@ static const struct reg_default wm5110_reg_default[] = {
545 { 0x00000328, 0x2000 }, /* R808 - IN4L Control */ 547 { 0x00000328, 0x2000 }, /* R808 - IN4L Control */
546 { 0x00000329, 0x0180 }, /* R809 - ADC Digital Volume 4L */ 548 { 0x00000329, 0x0180 }, /* R809 - ADC Digital Volume 4L */
547 { 0x0000032A, 0x0000 }, /* R810 - DMIC4L Control */ 549 { 0x0000032A, 0x0000 }, /* R810 - DMIC4L Control */
550 { 0x0000032C, 0x0000 }, /* R812 - IN4R Control */
548 { 0x0000032D, 0x0180 }, /* R813 - ADC Digital Volume 4R */ 551 { 0x0000032D, 0x0180 }, /* R813 - ADC Digital Volume 4R */
549 { 0x0000032E, 0x0000 }, /* R814 - DMIC4R Control */ 552 { 0x0000032E, 0x0000 }, /* R814 - DMIC4R Control */
550 { 0x00000400, 0x0000 }, /* R1024 - Output Enables 1 */ 553 { 0x00000400, 0x0000 }, /* R1024 - Output Enables 1 */
@@ -1342,6 +1345,64 @@ static const struct reg_default wm5110_reg_default[] = {
1342 { 0x00001404, 0x0000 }, /* R5124 - DSP4 Status 1 */ 1345 { 0x00001404, 0x0000 }, /* R5124 - DSP4 Status 1 */
1343}; 1346};
1344 1347
1348static bool wm5110_is_rev_b_adsp_memory(unsigned int reg)
1349{
1350 if ((reg >= 0x100000 && reg < 0x103000) ||
1351 (reg >= 0x180000 && reg < 0x181000) ||
1352 (reg >= 0x190000 && reg < 0x192000) ||
1353 (reg >= 0x1a8000 && reg < 0x1a9000) ||
1354 (reg >= 0x200000 && reg < 0x209000) ||
1355 (reg >= 0x280000 && reg < 0x281000) ||
1356 (reg >= 0x290000 && reg < 0x29a000) ||
1357 (reg >= 0x2a8000 && reg < 0x2aa000) ||
1358 (reg >= 0x300000 && reg < 0x30f000) ||
1359 (reg >= 0x380000 && reg < 0x382000) ||
1360 (reg >= 0x390000 && reg < 0x39e000) ||
1361 (reg >= 0x3a8000 && reg < 0x3b6000) ||
1362 (reg >= 0x400000 && reg < 0x403000) ||
1363 (reg >= 0x480000 && reg < 0x481000) ||
1364 (reg >= 0x490000 && reg < 0x492000) ||
1365 (reg >= 0x4a8000 && reg < 0x4a9000))
1366 return true;
1367 else
1368 return false;
1369}
1370
1371static bool wm5110_is_rev_d_adsp_memory(unsigned int reg)
1372{
1373 if ((reg >= 0x100000 && reg < 0x106000) ||
1374 (reg >= 0x180000 && reg < 0x182000) ||
1375 (reg >= 0x190000 && reg < 0x198000) ||
1376 (reg >= 0x1a8000 && reg < 0x1aa000) ||
1377 (reg >= 0x200000 && reg < 0x20f000) ||
1378 (reg >= 0x280000 && reg < 0x282000) ||
1379 (reg >= 0x290000 && reg < 0x29c000) ||
1380 (reg >= 0x2a6000 && reg < 0x2b4000) ||
1381 (reg >= 0x300000 && reg < 0x30f000) ||
1382 (reg >= 0x380000 && reg < 0x382000) ||
1383 (reg >= 0x390000 && reg < 0x3a2000) ||
1384 (reg >= 0x3a6000 && reg < 0x3b4000) ||
1385 (reg >= 0x400000 && reg < 0x406000) ||
1386 (reg >= 0x480000 && reg < 0x482000) ||
1387 (reg >= 0x490000 && reg < 0x498000) ||
1388 (reg >= 0x4a8000 && reg < 0x4aa000))
1389 return true;
1390 else
1391 return false;
1392}
1393
1394static bool wm5110_is_adsp_memory(struct device *dev, unsigned int reg)
1395{
1396 struct arizona *arizona = dev_get_drvdata(dev);
1397
1398 switch (arizona->rev) {
1399 case 0 ... 2:
1400 return wm5110_is_rev_b_adsp_memory(reg);
1401 default:
1402 return wm5110_is_rev_d_adsp_memory(reg);
1403 }
1404}
1405
1345static bool wm5110_readable_register(struct device *dev, unsigned int reg) 1406static bool wm5110_readable_register(struct device *dev, unsigned int reg)
1346{ 1407{
1347 switch (reg) { 1408 switch (reg) {
@@ -1460,6 +1521,7 @@ static bool wm5110_readable_register(struct device *dev, unsigned int reg)
1460 case ARIZONA_INPUT_ENABLES_STATUS: 1521 case ARIZONA_INPUT_ENABLES_STATUS:
1461 case ARIZONA_INPUT_RATE: 1522 case ARIZONA_INPUT_RATE:
1462 case ARIZONA_INPUT_VOLUME_RAMP: 1523 case ARIZONA_INPUT_VOLUME_RAMP:
1524 case ARIZONA_HPF_CONTROL:
1463 case ARIZONA_IN1L_CONTROL: 1525 case ARIZONA_IN1L_CONTROL:
1464 case ARIZONA_ADC_DIGITAL_VOLUME_1L: 1526 case ARIZONA_ADC_DIGITAL_VOLUME_1L:
1465 case ARIZONA_DMIC1L_CONTROL: 1527 case ARIZONA_DMIC1L_CONTROL:
@@ -1481,6 +1543,7 @@ static bool wm5110_readable_register(struct device *dev, unsigned int reg)
1481 case ARIZONA_IN4L_CONTROL: 1543 case ARIZONA_IN4L_CONTROL:
1482 case ARIZONA_ADC_DIGITAL_VOLUME_4L: 1544 case ARIZONA_ADC_DIGITAL_VOLUME_4L:
1483 case ARIZONA_DMIC4L_CONTROL: 1545 case ARIZONA_DMIC4L_CONTROL:
1546 case ARIZONA_IN4R_CONTROL:
1484 case ARIZONA_ADC_DIGITAL_VOLUME_4R: 1547 case ARIZONA_ADC_DIGITAL_VOLUME_4R:
1485 case ARIZONA_DMIC4R_CONTROL: 1548 case ARIZONA_DMIC4R_CONTROL:
1486 case ARIZONA_OUTPUT_ENABLES_1: 1549 case ARIZONA_OUTPUT_ENABLES_1:
@@ -2331,7 +2394,7 @@ static bool wm5110_readable_register(struct device *dev, unsigned int reg)
2331 case ARIZONA_DSP4_SCRATCH_3: 2394 case ARIZONA_DSP4_SCRATCH_3:
2332 return true; 2395 return true;
2333 default: 2396 default:
2334 return false; 2397 return wm5110_is_adsp_memory(dev, reg);
2335 } 2398 }
2336} 2399}
2337 2400
@@ -2407,16 +2470,18 @@ static bool wm5110_volatile_register(struct device *dev, unsigned int reg)
2407 case ARIZONA_DSP4_SCRATCH_3: 2470 case ARIZONA_DSP4_SCRATCH_3:
2408 return true; 2471 return true;
2409 default: 2472 default:
2410 return false; 2473 return wm5110_is_adsp_memory(dev, reg);
2411 } 2474 }
2412} 2475}
2413 2476
2477#define WM5110_MAX_REGISTER 0x4a9fff
2478
2414const struct regmap_config wm5110_spi_regmap = { 2479const struct regmap_config wm5110_spi_regmap = {
2415 .reg_bits = 32, 2480 .reg_bits = 32,
2416 .pad_bits = 16, 2481 .pad_bits = 16,
2417 .val_bits = 16, 2482 .val_bits = 16,
2418 2483
2419 .max_register = ARIZONA_DSP1_STATUS_2, 2484 .max_register = WM5110_MAX_REGISTER,
2420 .readable_reg = wm5110_readable_register, 2485 .readable_reg = wm5110_readable_register,
2421 .volatile_reg = wm5110_volatile_register, 2486 .volatile_reg = wm5110_volatile_register,
2422 2487
@@ -2430,7 +2495,7 @@ const struct regmap_config wm5110_i2c_regmap = {
2430 .reg_bits = 32, 2495 .reg_bits = 32,
2431 .val_bits = 16, 2496 .val_bits = 16,
2432 2497
2433 .max_register = ARIZONA_DSP1_STATUS_2, 2498 .max_register = WM5110_MAX_REGISTER,
2434 .readable_reg = wm5110_readable_register, 2499 .readable_reg = wm5110_readable_register,
2435 .volatile_reg = wm5110_volatile_register, 2500 .volatile_reg = wm5110_volatile_register,
2436 2501