| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * wm8741.c -- WM8741 ALSA SoC Audio driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright 2010-1 Wolfson Microelectronics plc |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Author: Ian Lartey <ian@opensource.wolfsonmicro.com> |
|---|
| 7 | | - * |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 10 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 11 | | - * published by the Free Software Foundation. |
|---|
| 12 | 8 | */ |
|---|
| 13 | 9 | |
|---|
| 14 | 10 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 196 | 192 | { |
|---|
| 197 | 193 | struct snd_soc_component *component = dai->component; |
|---|
| 198 | 194 | struct wm8741_priv *wm8741 = snd_soc_component_get_drvdata(component); |
|---|
| 199 | | - unsigned int iface; |
|---|
| 195 | + unsigned int iface, mode; |
|---|
| 200 | 196 | int i; |
|---|
| 201 | 197 | |
|---|
| 202 | 198 | /* The set of sample rates that can be supported depends on the |
|---|
| .. | .. |
|---|
| 240 | 236 | return -EINVAL; |
|---|
| 241 | 237 | } |
|---|
| 242 | 238 | |
|---|
| 239 | + /* oversampling rate */ |
|---|
| 240 | + if (params_rate(params) > 96000) |
|---|
| 241 | + mode = 0x40; |
|---|
| 242 | + else if (params_rate(params) > 48000) |
|---|
| 243 | + mode = 0x20; |
|---|
| 244 | + else |
|---|
| 245 | + mode = 0x00; |
|---|
| 246 | + |
|---|
| 243 | 247 | dev_dbg(component->dev, "wm8741_hw_params: bit size param = %d, rate param = %d", |
|---|
| 244 | 248 | params_width(params), params_rate(params)); |
|---|
| 245 | 249 | |
|---|
| 246 | 250 | snd_soc_component_update_bits(component, WM8741_FORMAT_CONTROL, WM8741_IWL_MASK, |
|---|
| 247 | 251 | iface); |
|---|
| 252 | + snd_soc_component_update_bits(component, WM8741_MODE_CONTROL_1, WM8741_OSR_MASK, |
|---|
| 253 | + mode); |
|---|
| 248 | 254 | |
|---|
| 249 | 255 | return 0; |
|---|
| 250 | 256 | } |
|---|
| .. | .. |
|---|
| 358 | 364 | return 0; |
|---|
| 359 | 365 | } |
|---|
| 360 | 366 | |
|---|
| 367 | +static int wm8741_mute(struct snd_soc_dai *codec_dai, int mute, int direction) |
|---|
| 368 | +{ |
|---|
| 369 | + struct snd_soc_component *component = codec_dai->component; |
|---|
| 370 | + |
|---|
| 371 | + snd_soc_component_update_bits(component, WM8741_VOLUME_CONTROL, |
|---|
| 372 | + WM8741_SOFT_MASK, !!mute << WM8741_SOFT_SHIFT); |
|---|
| 373 | + return 0; |
|---|
| 374 | +} |
|---|
| 375 | + |
|---|
| 361 | 376 | #define WM8741_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ |
|---|
| 362 | 377 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | \ |
|---|
| 363 | 378 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 | \ |
|---|
| .. | .. |
|---|
| 371 | 386 | .hw_params = wm8741_hw_params, |
|---|
| 372 | 387 | .set_sysclk = wm8741_set_dai_sysclk, |
|---|
| 373 | 388 | .set_fmt = wm8741_set_dai_fmt, |
|---|
| 389 | + .mute_stream = wm8741_mute, |
|---|
| 390 | + .no_capture_mute = 1, |
|---|
| 374 | 391 | }; |
|---|
| 375 | 392 | |
|---|
| 376 | 393 | static struct snd_soc_dai_driver wm8741_dai = { |
|---|