forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 1f93a7dfd1f8d5ff7a5c53246c7534fe2332d6f4
kernel/sound/soc/codecs/nau8825.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Nuvoton NAU8825 audio codec driver
34 *
....@@ -5,8 +6,6 @@
56 * Author: Anatol Pomozov <anatol@chromium.org>
67 * Copyright 2015 Nuvoton Technology Corp.
78 * Co-author: Meng-Huang Kuo <mhkuo@nuvoton.com>
8
- *
9
- * Licensed under the GPL-2.
109 */
1110
1211 #include <linux/module.h>
....@@ -252,7 +251,7 @@
252251 *
253252 * Acquires the semaphore without jiffies. Try to acquire the semaphore
254253 * atomically. Returns 0 if the semaphore has been acquired successfully
255
- * or 1 if it it cannot be acquired.
254
+ * or 1 if it cannot be acquired.
256255 */
257256 static int nau8825_sema_acquire(struct nau8825 *nau8825, long timeout)
258257 {
....@@ -351,6 +350,7 @@
351350 * Computes log10 of a value; the result is round off to 3 decimal. This func-
352351 * tion takes reference to dvb-math. The source code locates as the following.
353352 * Linux/drivers/media/dvb-core/dvb_math.c
353
+ * @value: input for log10
354354 *
355355 * return log10(value) * 1000
356356 */
....@@ -424,10 +424,8 @@
424424 {
425425 u32 gain, sidetone;
426426
427
- if (unlikely(sig_org == 0) || unlikely(sig_cros == 0)) {
428
- WARN_ON(1);
427
+ if (WARN_ON(sig_org == 0 || sig_cros == 0))
429428 return 0;
430
- }
431429
432430 sig_org = nau8825_intlog10_dec3(sig_org);
433431 sig_cros = nau8825_intlog10_dec3(sig_cros);
....@@ -1882,6 +1880,10 @@
18821880 NAU8825_JACK_EJECT_DEBOUNCE_MASK,
18831881 nau8825->jack_eject_debounce << NAU8825_JACK_EJECT_DEBOUNCE_SFT);
18841882
1883
+ /* Pull up IRQ pin */
1884
+ regmap_update_bits(regmap, NAU8825_REG_INTERRUPT_MASK,
1885
+ NAU8825_IRQ_PIN_PULLUP | NAU8825_IRQ_PIN_PULL_EN,
1886
+ NAU8825_IRQ_PIN_PULLUP | NAU8825_IRQ_PIN_PULL_EN);
18851887 /* Mask unneeded IRQs: 1 - disable, 0 - enable */
18861888 regmap_update_bits(regmap, NAU8825_REG_INTERRUPT_MASK, 0x7ff, 0x7ff);
18871889