History

mfd: max77620: Support Maxim 77663

Add support for Maxim 77663 using the Max77620 driver. The hardware is very similar to Max77663/20024, although there are couple minor differences.

Dmitry Osipenko committed 7 years ago

Commit 4c58f701 parent ea611d12 files · +69 −1Browse files

Unified · Split

2 files
  1. drivers/mfd/max77620.c +68 −1
  2. include/linux/mfd/max77620.h +1 −0
drivers/mfd/max77620.c+68−1
@@ -111,6 +111,26 @@ static const struct mfd_cell max20024_children[] = { · 110 unmodified lines
111111 },
112112 };
113113
114+static const struct mfd_cell max77663_children[] = {
115+ { .name = "max77620-pinctrl", },
116+ { .name = "max77620-clock", },
117+ { .name = "max77663-pmic", },
118+ { .name = "max77620-watchdog", },
119+ {
120+ .name = "max77620-gpio",
121+ .resources = gpio_resources,
122+ .num_resources = ARRAY_SIZE(gpio_resources),
123+ }, {
124+ .name = "max77620-rtc",
125+ .resources = rtc_resources,
126+ .num_resources = ARRAY_SIZE(rtc_resources),
127+ }, {
128+ .name = "max77663-power",
129+ .resources = power_resources,
130+ .num_resources = ARRAY_SIZE(power_resources),
131+ },
132+};
133+
114134 static const struct regmap_range max77620_readable_ranges[] = {
115135 regmap_reg_range(MAX77620_REG_CNFGGLBL1, MAX77620_REG_DVSSD4),
116136 };
@@ -171,6 +191,35 @@ static const struct regmap_config max20024_regmap_config = { · 54 unmodified lines
171191 .volatile_table = &max77620_volatile_table,
172192 };
173193
194+static const struct regmap_range max77663_readable_ranges[] = {
195+ regmap_reg_range(MAX77620_REG_CNFGGLBL1, MAX77620_REG_CID5),
196+};
197+
198+static const struct regmap_access_table max77663_readable_table = {
199+ .yes_ranges = max77663_readable_ranges,
200+ .n_yes_ranges = ARRAY_SIZE(max77663_readable_ranges),
201+};
202+
203+static const struct regmap_range max77663_writable_ranges[] = {
204+ regmap_reg_range(MAX77620_REG_CNFGGLBL1, MAX77620_REG_CID5),
205+};
206+
207+static const struct regmap_access_table max77663_writable_table = {
208+ .yes_ranges = max77663_writable_ranges,
209+ .n_yes_ranges = ARRAY_SIZE(max77663_writable_ranges),
210+};
211+
212+static const struct regmap_config max77663_regmap_config = {
213+ .name = "power-slave",
214+ .reg_bits = 8,
215+ .val_bits = 8,
216+ .max_register = MAX77620_REG_CID5 + 1,
217+ .cache_type = REGCACHE_RBTREE,
218+ .rd_table = &max77663_readable_table,
219+ .wr_table = &max77663_writable_table,
220+ .volatile_table = &max77620_volatile_table,
221+};
222+
174223 /*
175224 * MAX77620 and MAX20024 has the following steps of the interrupt handling
176225 * for TOP interrupts:
@@ -240,6 +289,9 @@ static int max77620_get_fps_period_reg_value(struct max77620_chip *chip, · 63 unmodified lines
240289 case MAX77620:
241290 fps_min_period = MAX77620_FPS_PERIOD_MIN_US;
242291 break;
292+ case MAX77663:
293+ fps_min_period = MAX20024_FPS_PERIOD_MIN_US;
294+ break;
243295 default:
244296 return -EINVAL;
245297 }
@@ -274,6 +326,9 @@ static int max77620_config_fps(struct max77620_chip *chip, · 28 unmodified lines
274326 case MAX77620:
275327 fps_max_period = MAX77620_FPS_PERIOD_MAX_US;
276328 break;
329+ case MAX77663:
330+ fps_max_period = MAX20024_FPS_PERIOD_MAX_US;
331+ break;
277332 default:
278333 return -EINVAL;
279334 }
@@ -375,6 +430,9 @@ static int max77620_initialise_fps(struct max77620_chip *chip) · 95 unmodified lines
375430 }
376431
377432 skip_fps:
433+ if (chip->chip_id == MAX77663)
434+ return 0;
435+
378436 /* Enable wake on EN0 pin */
379437 ret = regmap_update_bits(chip->rmap, MAX77620_REG_ONOFFCNFG2,
380438 MAX77620_ONOFFCNFG2_WK_EN0,
@@ -453,6 +511,11 @@ static int max77620_probe(struct i2c_client *client, · 72 unmodified lines
453511 n_mfd_cells = ARRAY_SIZE(max20024_children);
454512 rmap_config = &max20024_regmap_config;
455513 break;
514+ case MAX77663:
515+ mfd_cells = max77663_children;
516+ n_mfd_cells = ARRAY_SIZE(max77663_children);
517+ rmap_config = &max77663_regmap_config;
518+ break;
456519 default:
457520 dev_err(chip->dev, "ChipID is invalid %d\n", chip->chip_id);
458521 return -EINVAL;
@@ -546,6 +609,9 @@ static int max77620_i2c_suspend(struct device *dev) · 87 unmodified lines
546609 return ret;
547610 }
548611
612+ if (chip->chip_id == MAX77663)
613+ goto out;
614+
549615 /* Disable WK_EN0 */
550616 ret = regmap_update_bits(chip->rmap, MAX77620_REG_ONOFFCNFG2,
551617 MAX77620_ONOFFCNFG2_WK_EN0, 0);
@@ -581,7 +647,7 @@ static int max77620_i2c_resume(struct device *dev) · 29 unmodified lines
581647 * For MAX20024: No need to configure WKEN0 on resume as
582648 * it is configured on Init.
583649 */
584− if (chip->chip_id == MAX20024)
650+ if (chip->chip_id == MAX20024 || chip->chip_id == MAX77663)
585651 goto out;
586652
587653 /* Enable WK_EN0 */
@@ -603,6 +669,7 @@ out: · 15 unmodified lines
603669 static const struct i2c_device_id max77620_id[] = {
604670 {"max77620", MAX77620},
605671 {"max20024", MAX20024},
672+ {"max77663", MAX77663},
606673 {},
607674 };
608675
include/linux/mfd/max77620.h+1−0
@@ -324,6 +324,7 @@ enum max77620_fps_src { · 323 unmodified lines
324324 enum max77620_chip_id {
325325 MAX77620,
326326 MAX20024,
327+ MAX77663,
327328 };
328329
329330 struct max77620_chip {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t