hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/sound/soc/codecs/ak4104.c
....@@ -1,19 +1,15 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * AK4104 ALSA SoC (ASoC) driver
34 *
45 * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
5
- *
6
- * This program is free software; you can redistribute it and/or modify it
7
- * under the terms of the GNU General Public License as published by the
8
- * Free Software Foundation; either version 2 of the License, or (at your
9
- * option) any later version.
106 */
117
128 #include <linux/module.h>
139 #include <linux/slab.h>
1410 #include <linux/spi/spi.h>
1511 #include <linux/of_device.h>
16
-#include <linux/of_gpio.h>
12
+#include <linux/gpio/consumer.h>
1713 #include <linux/regulator/consumer.h>
1814 #include <sound/asoundef.h>
1915 #include <sound/core.h>
....@@ -268,8 +264,8 @@
268264
269265 static int ak4104_spi_probe(struct spi_device *spi)
270266 {
271
- struct device_node *np = spi->dev.of_node;
272267 struct ak4104_private *ak4104;
268
+ struct gpio_desc *reset_gpiod;
273269 unsigned int val;
274270 int ret;
275271
....@@ -297,19 +293,10 @@
297293 return ret;
298294 }
299295
300
- if (np) {
301
- enum of_gpio_flags flags;
302
- int gpio = of_get_named_gpio_flags(np, "reset-gpio", 0, &flags);
303
-
304
- if (gpio_is_valid(gpio)) {
305
- ret = devm_gpio_request_one(&spi->dev, gpio,
306
- flags & OF_GPIO_ACTIVE_LOW ?
307
- GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH,
308
- "ak4104 reset");
309
- if (ret < 0)
310
- return ret;
311
- }
312
- }
296
+ reset_gpiod = devm_gpiod_get_optional(&spi->dev, "reset",
297
+ GPIOD_OUT_HIGH);
298
+ if (PTR_ERR(reset_gpiod) == -EPROBE_DEFER)
299
+ return -EPROBE_DEFER;
313300
314301 /* read the 'reserved' register - according to the datasheet, it
315302 * should contain 0x5b. Not a good way to verify the presence of