.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * TI LP8788 MFD - ldo regulator driver |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright 2012 Texas Instruments |
---|
5 | 6 | * |
---|
6 | 7 | * Author: Milo(Woogyom) Kim <milo.kim@ti.com> |
---|
7 | | - * |
---|
8 | | - * This program is free software; you can redistribute it and/or modify |
---|
9 | | - * it under the terms of the GNU General Public License version 2 as |
---|
10 | | - * published by the Free Software Foundation. |
---|
11 | | - * |
---|
12 | 8 | */ |
---|
13 | 9 | |
---|
14 | 10 | #include <linux/module.h> |
---|
.. | .. |
---|
186 | 182 | .enable_time = lp8788_ldo_enable_time, |
---|
187 | 183 | }; |
---|
188 | 184 | |
---|
189 | | -static struct regulator_desc lp8788_dldo_desc[] = { |
---|
| 185 | +static const struct regulator_desc lp8788_dldo_desc[] = { |
---|
190 | 186 | { |
---|
191 | 187 | .name = "dldo1", |
---|
192 | 188 | .id = DLDO1, |
---|
.. | .. |
---|
343 | 339 | }, |
---|
344 | 340 | }; |
---|
345 | 341 | |
---|
346 | | -static struct regulator_desc lp8788_aldo_desc[] = { |
---|
| 342 | +static const struct regulator_desc lp8788_aldo_desc[] = { |
---|
347 | 343 | { |
---|
348 | 344 | .name = "aldo1", |
---|
349 | 345 | .id = ALDO1, |
---|
.. | .. |
---|
468 | 464 | { |
---|
469 | 465 | struct lp8788 *lp = ldo->lp; |
---|
470 | 466 | enum lp8788_ext_ldo_en_id enable_id; |
---|
471 | | - u8 en_mask[] = { |
---|
| 467 | + static const u8 en_mask[] = { |
---|
472 | 468 | [EN_ALDO1] = LP8788_EN_SEL_ALDO1_M, |
---|
473 | 469 | [EN_ALDO234] = LP8788_EN_SEL_ALDO234_M, |
---|
474 | 470 | [EN_ALDO5] = LP8788_EN_SEL_ALDO5_M, |
---|
.. | .. |
---|
501 | 497 | return 0; |
---|
502 | 498 | } |
---|
503 | 499 | |
---|
504 | | - /* FIXME: check default mode for GPIO here: high or low? */ |
---|
505 | | - ldo->ena_gpiod = devm_gpiod_get_index_optional(&pdev->dev, |
---|
506 | | - "enable", |
---|
507 | | - enable_id, |
---|
508 | | - GPIOD_OUT_HIGH); |
---|
| 500 | + /* |
---|
| 501 | + * Do not use devm* here: the regulator core takes over the |
---|
| 502 | + * lifecycle management of the GPIO descriptor. |
---|
| 503 | + * FIXME: check default mode for GPIO here: high or low? |
---|
| 504 | + */ |
---|
| 505 | + ldo->ena_gpiod = gpiod_get_index_optional(&pdev->dev, |
---|
| 506 | + "enable", |
---|
| 507 | + enable_id, |
---|
| 508 | + GPIOD_OUT_HIGH | |
---|
| 509 | + GPIOD_FLAGS_BIT_NONEXCLUSIVE); |
---|
509 | 510 | if (IS_ERR(ldo->ena_gpiod)) |
---|
510 | 511 | return PTR_ERR(ldo->ena_gpiod); |
---|
511 | 512 | |
---|