Skip to content

Commit

Permalink
Merge branch 'for-linus' into for-next
Browse files Browse the repository at this point in the history
  • Loading branch information
tiwai committed Feb 15, 2022
2 parents 0707541 + 5948342 commit a9f73b0
Show file tree
Hide file tree
Showing 42 changed files with 363 additions and 165 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ title: Audio codec controlled by ChromeOS EC

maintainers:
- Cheng-Yi Chiang <cychiang@chromium.org>
- Tzung-Bi Shih <tzungbi@google.com>

description: |
Google's ChromeOS EC codec is a digital mic codec provided by the
Expand Down
1 change: 1 addition & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -4543,6 +4543,7 @@ F: drivers/platform/chrome/

CHROMEOS EC CODEC DRIVER
M: Cheng-Yi Chiang <cychiang@chromium.org>
M: Tzung-Bi Shih <tzungbi@google.com>
R: Guenter Roeck <groeck@chromium.org>
S: Maintained
F: Documentation/devicetree/bindings/sound/google,cros-ec-codec.yaml
Expand Down
12 changes: 3 additions & 9 deletions drivers/input/touchscreen/wm97xx-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,10 +615,9 @@ static int wm97xx_register_touch(struct wm97xx *wm)
* extensions)
*/
wm->touch_dev = platform_device_alloc("wm97xx-touch", -1);
if (!wm->touch_dev) {
ret = -ENOMEM;
goto touch_err;
}
if (!wm->touch_dev)
return -ENOMEM;

platform_set_drvdata(wm->touch_dev, wm);
wm->touch_dev->dev.parent = wm->dev;
wm->touch_dev->dev.platform_data = pdata;
Expand All @@ -629,18 +628,13 @@ static int wm97xx_register_touch(struct wm97xx *wm)
return 0;
touch_reg_err:
platform_device_put(wm->touch_dev);
touch_err:
input_unregister_device(wm->input_dev);
wm->input_dev = NULL;

return ret;
}

static void wm97xx_unregister_touch(struct wm97xx *wm)
{
platform_device_unregister(wm->touch_dev);
input_unregister_device(wm->input_dev);
wm->input_dev = NULL;
}

static int _wm97xx_probe(struct wm97xx *wm)
Expand Down
15 changes: 4 additions & 11 deletions drivers/soc/mediatek/mtk-scpsys.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,17 +411,12 @@ static int scpsys_power_off(struct generic_pm_domain *genpd)
return ret;
}

static int init_clks(struct platform_device *pdev, struct clk **clk)
static void init_clks(struct platform_device *pdev, struct clk **clk)
{
int i;

for (i = CLK_NONE + 1; i < CLK_MAX; i++) {
for (i = CLK_NONE + 1; i < CLK_MAX; i++)
clk[i] = devm_clk_get(&pdev->dev, clk_names[i]);
if (IS_ERR(clk[i]))
return PTR_ERR(clk[i]);
}

return 0;
}

static struct scp *init_scp(struct platform_device *pdev,
Expand All @@ -431,7 +426,7 @@ static struct scp *init_scp(struct platform_device *pdev,
{
struct genpd_onecell_data *pd_data;
struct resource *res;
int i, j, ret;
int i, j;
struct scp *scp;
struct clk *clk[CLK_MAX];

Expand Down Expand Up @@ -486,9 +481,7 @@ static struct scp *init_scp(struct platform_device *pdev,

pd_data->num_domains = num;

ret = init_clks(pdev, clk);
if (ret)
return ERR_PTR(ret);
init_clks(pdev, clk);

for (i = 0; i < num; i++) {
struct scp_domain *scpd = &scp->domains[i];
Expand Down
15 changes: 15 additions & 0 deletions include/sound/pcm.h
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ void snd_pcm_stream_unlock(struct snd_pcm_substream *substream);
void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream);
void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream);
unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream);
unsigned long _snd_pcm_stream_lock_irqsave_nested(struct snd_pcm_substream *substream);

/**
* snd_pcm_stream_lock_irqsave - Lock the PCM stream
Expand All @@ -635,6 +636,20 @@ unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream);
void snd_pcm_stream_unlock_irqrestore(struct snd_pcm_substream *substream,
unsigned long flags);

/**
* snd_pcm_stream_lock_irqsave_nested - Single-nested PCM stream locking
* @substream: PCM substream
* @flags: irq flags
*
* This locks the PCM stream like snd_pcm_stream_lock_irqsave() but with
* the single-depth lockdep subclass.
*/
#define snd_pcm_stream_lock_irqsave_nested(substream, flags) \
do { \
typecheck(unsigned long, flags); \
flags = _snd_pcm_stream_lock_irqsave_nested(substream); \
} while (0)

/**
* snd_pcm_group_for_each_entry - iterate over the linked substreams
* @s: the iterator
Expand Down
4 changes: 3 additions & 1 deletion include/uapi/sound/asound.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@
* *
****************************************************************************/

#define AES_IEC958_STATUS_SIZE 24

struct snd_aes_iec958 {
unsigned char status[24]; /* AES/IEC958 channel status bits */
unsigned char status[AES_IEC958_STATUS_SIZE]; /* AES/IEC958 channel status bits */
unsigned char subcode[147]; /* AES/IEC958 subcode bits */
unsigned char pad; /* nothing */
unsigned char dig_subframe[4]; /* AES/IEC958 subframe bits */
Expand Down
15 changes: 10 additions & 5 deletions sound/core/memalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,8 @@ static void *snd_dma_noncontig_alloc(struct snd_dma_buffer *dmab, size_t size)
DEFAULT_GFP, 0);
if (!sgt)
return NULL;
dmab->dev.need_sync = dma_need_sync(dmab->dev.dev, dmab->dev.dir);
dmab->dev.need_sync = dma_need_sync(dmab->dev.dev,
sg_dma_address(sgt->sgl));
p = dma_vmap_noncontiguous(dmab->dev.dev, size, sgt);
if (p)
dmab->private_data = sgt;
Expand Down Expand Up @@ -540,9 +541,9 @@ static void snd_dma_noncontig_sync(struct snd_dma_buffer *dmab,
if (mode == SNDRV_DMA_SYNC_CPU) {
if (dmab->dev.dir == DMA_TO_DEVICE)
return;
invalidate_kernel_vmap_range(dmab->area, dmab->bytes);
dma_sync_sgtable_for_cpu(dmab->dev.dev, dmab->private_data,
dmab->dev.dir);
invalidate_kernel_vmap_range(dmab->area, dmab->bytes);
} else {
if (dmab->dev.dir == DMA_FROM_DEVICE)
return;
Expand Down Expand Up @@ -671,9 +672,13 @@ static const struct snd_malloc_ops snd_dma_sg_wc_ops = {
*/
static void *snd_dma_noncoherent_alloc(struct snd_dma_buffer *dmab, size_t size)
{
dmab->dev.need_sync = dma_need_sync(dmab->dev.dev, dmab->dev.dir);
return dma_alloc_noncoherent(dmab->dev.dev, size, &dmab->addr,
dmab->dev.dir, DEFAULT_GFP);
void *p;

p = dma_alloc_noncoherent(dmab->dev.dev, size, &dmab->addr,
dmab->dev.dir, DEFAULT_GFP);
if (p)
dmab->dev.need_sync = dma_need_sync(dmab->dev.dev, dmab->addr);
return p;
}

static void snd_dma_noncoherent_free(struct snd_dma_buffer *dmab)
Expand Down
13 changes: 13 additions & 0 deletions sound/core/pcm_native.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,19 @@ unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream)
}
EXPORT_SYMBOL_GPL(_snd_pcm_stream_lock_irqsave);

unsigned long _snd_pcm_stream_lock_irqsave_nested(struct snd_pcm_substream *substream)
{
unsigned long flags = 0;
if (substream->pcm->nonatomic)
mutex_lock_nested(&substream->self_group.mutex,
SINGLE_DEPTH_NESTING);
else
spin_lock_irqsave_nested(&substream->self_group.lock, flags,
SINGLE_DEPTH_NESTING);
return flags;
}
EXPORT_SYMBOL_GPL(_snd_pcm_stream_lock_irqsave_nested);

/**
* snd_pcm_stream_unlock_irqrestore - Unlock the PCM stream
* @substream: PCM substream
Expand Down
7 changes: 3 additions & 4 deletions sound/hda/intel-sdw-acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ static bool is_link_enabled(struct fwnode_handle *fw_node, int i)
static int
sdw_intel_scan_controller(struct sdw_intel_acpi_info *info)
{
struct acpi_device *adev;
struct acpi_device *adev = acpi_fetch_acpi_dev(info->handle);
int ret, i;
u8 count;

if (acpi_bus_get_device(info->handle, &adev))
if (!adev)
return -EINVAL;

/* Found controller, find links supported */
Expand Down Expand Up @@ -119,15 +119,14 @@ static acpi_status sdw_intel_acpi_cb(acpi_handle handle, u32 level,
void *cdata, void **return_value)
{
struct sdw_intel_acpi_info *info = cdata;
struct acpi_device *adev;
acpi_status status;
u64 adr;

status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &adr);
if (ACPI_FAILURE(status))
return AE_OK; /* keep going */

if (acpi_bus_get_device(handle, &adev)) {
if (!acpi_fetch_acpi_dev(handle)) {
pr_err("%s: Couldn't find ACPI handle\n", __func__);
return AE_NOT_FOUND;
}
Expand Down
2 changes: 1 addition & 1 deletion sound/pci/hda/hda_auto_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ void snd_hda_pick_fixup(struct hda_codec *codec,
int id = HDA_FIXUP_ID_NOT_SET;
const char *name = NULL;
const char *type = NULL;
int vendor, device;
unsigned int vendor, device;

if (codec->fixup_id != HDA_FIXUP_ID_NOT_SET)
return;
Expand Down
4 changes: 4 additions & 0 deletions sound/pci/hda/hda_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -3000,6 +3000,10 @@ void snd_hda_codec_shutdown(struct hda_codec *codec)
{
struct hda_pcm *cpcm;

/* Skip the shutdown if codec is not registered */
if (!codec->registered)
return;

list_for_each_entry(cpcm, &codec->pcm_list_head, list)
snd_pcm_suspend_all(cpcm->pcm);

Expand Down
17 changes: 15 additions & 2 deletions sound/pci/hda/hda_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ static void snd_hda_gen_spec_free(struct hda_gen_spec *spec)
free_kctls(spec);
snd_array_free(&spec->paths);
snd_array_free(&spec->loopback_list);
#ifdef CONFIG_SND_HDA_GENERIC_LEDS
if (spec->led_cdevs[LED_AUDIO_MUTE])
led_classdev_unregister(spec->led_cdevs[LED_AUDIO_MUTE]);
if (spec->led_cdevs[LED_AUDIO_MICMUTE])
led_classdev_unregister(spec->led_cdevs[LED_AUDIO_MICMUTE]);
#endif
}

/*
Expand Down Expand Up @@ -3922,7 +3928,10 @@ static int create_mute_led_cdev(struct hda_codec *codec,
enum led_brightness),
bool micmute)
{
struct hda_gen_spec *spec = codec->spec;
struct led_classdev *cdev;
int idx = micmute ? LED_AUDIO_MICMUTE : LED_AUDIO_MUTE;
int err;

cdev = devm_kzalloc(&codec->core.dev, sizeof(*cdev), GFP_KERNEL);
if (!cdev)
Expand All @@ -3932,10 +3941,14 @@ static int create_mute_led_cdev(struct hda_codec *codec,
cdev->max_brightness = 1;
cdev->default_trigger = micmute ? "audio-micmute" : "audio-mute";
cdev->brightness_set_blocking = callback;
cdev->brightness = ledtrig_audio_get(micmute ? LED_AUDIO_MICMUTE : LED_AUDIO_MUTE);
cdev->brightness = ledtrig_audio_get(idx);
cdev->flags = LED_CORE_SUSPENDRESUME;

return devm_led_classdev_register(&codec->core.dev, cdev);
err = led_classdev_register(&codec->core.dev, cdev);
if (err < 0)
return err;
spec->led_cdevs[idx] = cdev;
return 0;
}

/**
Expand Down
3 changes: 3 additions & 0 deletions sound/pci/hda/hda_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,9 @@ struct hda_gen_spec {
struct hda_jack_callback *cb);
void (*mic_autoswitch_hook)(struct hda_codec *codec,
struct hda_jack_callback *cb);

/* leds */
struct led_classdev *led_cdevs[NUM_AUDIO_LEDS];
};

/* values for add_stereo_mix_input flag */
Expand Down
5 changes: 3 additions & 2 deletions sound/pci/hda/hda_intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1615,6 +1615,7 @@ static const struct snd_pci_quirk probe_mask_list[] = {
/* forced codec slots */
SND_PCI_QUIRK(0x1043, 0x1262, "ASUS W5Fm", 0x103),
SND_PCI_QUIRK(0x1046, 0x1262, "ASUS W5F", 0x103),
SND_PCI_QUIRK(0x1558, 0x0351, "Schenker Dock 15", 0x105),
/* WinFast VP200 H (Teradici) user reported broken communication */
SND_PCI_QUIRK(0x3a21, 0x040d, "WinFast VP200 H", 0x101),
{}
Expand Down Expand Up @@ -1798,8 +1799,6 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci,

assign_position_fix(chip, check_position_fix(chip, position_fix[dev]));

check_probe_mask(chip, dev);

if (single_cmd < 0) /* allow fallback to single_cmd at errors */
chip->fallback_to_single_cmd = 1;
else /* explicitly set to single_cmd or not */
Expand All @@ -1825,6 +1824,8 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci,
chip->bus.core.needs_damn_long_delay = 1;
}

check_probe_mask(chip, dev);

err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
if (err < 0) {
dev_err(card->dev, "Error creating device [card]!\n");
Expand Down
Loading

0 comments on commit a9f73b0

Please sign in to comment.