Skip to content

Commit

Permalink
Merge remote-tracking branches 'asoc/topic/omap', 'asoc/topic/rcar' a…
Browse files Browse the repository at this point in the history
…nd 'asoc/topic/rockchip' into asoc-next
  • Loading branch information
Mark Brown committed Jul 24, 2016
4 parents c704f4e + 65aca64 + 53ae918 + 46dd2e2 commit f341378
Show file tree
Hide file tree
Showing 19 changed files with 504 additions and 308 deletions.
10 changes: 10 additions & 0 deletions Documentation/devicetree/bindings/sound/omap-mcpdm.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Required properties:
- interrupts: Interrupt number for McPDM
- interrupt-parent: The parent interrupt controller
- ti,hwmods: Name of the hwmod associated to the McPDM
- clocks: phandle for the pdmclk provider, likely <&twl6040>
- clock-names: Must be "pdmclk"

Example:

Expand All @@ -19,3 +21,11 @@ mcpdm: mcpdm@40132000 {
interrupt-parent = <&gic>;
ti,hwmods = "mcpdm";
};

In board DTS file the pdmclk needs to be added:

&mcpdm {
clocks = <&twl6040>;
clock-names = "pdmclk";
status = "okay";
};
2 changes: 2 additions & 0 deletions Documentation/devicetree/bindings/sound/renesas,rsnd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,8 @@ Optional properties:
- #clock-cells : it must be 0 if your system has audio_clkout
it must be 1 if your system has audio_clkout0/1/2/3
- clock-frequency : for all audio_clkout0/1/2/3
- clkout-lr-asynchronous : boolean property. it indicates that audio_clkoutn
is asynchronizes with lr-clock.

SSI subnode properties:
- interrupts : Should contain SSI interrupt for PIO transfer
Expand Down
5 changes: 5 additions & 0 deletions Documentation/devicetree/bindings/sound/rockchip-i2s.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ Required properties:
- rockchip,playback-channels: max playback channels, if not set, 8 channels default.
- rockchip,capture-channels: max capture channels, if not set, 2 channels default.

Required properties for controller which support multi channels
playback/capture:

- rockchip,grf: the phandle of the syscon node for GRF register.

Example for rk3288 I2S controller:

i2s@ff890000 {
Expand Down
11 changes: 1 addition & 10 deletions include/sound/simple_card.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,7 @@
#define __SIMPLE_CARD_H

#include <sound/soc.h>

struct asoc_simple_dai {
const char *name;
unsigned int sysclk;
int slots;
int slot_width;
unsigned int tx_slot_mask;
unsigned int rx_slot_mask;
struct clk *clk;
};
#include <sound/simple_card_utils.h>

struct asoc_simple_card_info {
const char *name;
Expand Down
36 changes: 36 additions & 0 deletions include/sound/simple_card_utils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* simple_card_core.h
*
* Copyright (c) 2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef __SIMPLE_CARD_CORE_H
#define __SIMPLE_CARD_CORE_H

#include <sound/soc.h>

struct asoc_simple_dai {
const char *name;
unsigned int sysclk;
int slots;
int slot_width;
unsigned int tx_slot_mask;
unsigned int rx_slot_mask;
struct clk *clk;
};

int asoc_simple_card_parse_daifmt(struct device *dev,
struct device_node *node,
struct device_node *codec,
char *prefix,
unsigned int *retfmt);
int asoc_simple_card_set_dailink_name(struct device *dev,
struct snd_soc_dai_link *dai_link,
const char *fmt, ...);
int asoc_simple_card_parse_card_name(struct snd_soc_card *card,
char *prefix);

#endif /* __SIMPLE_CARD_CORE_H */
4 changes: 4 additions & 0 deletions sound/soc/generic/Kconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
config SND_SIMPLE_CARD_UTILS
tristate

config SND_SIMPLE_CARD
tristate "ASoC Simple sound card support"
select SND_SIMPLE_CARD_UTILS
help
This option enables generic simple sound card support
2 changes: 2 additions & 0 deletions sound/soc/generic/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
obj-$(CONFIG_SND_SIMPLE_CARD_UTILS) := simple-card-utils.o

snd-soc-simple-card-objs := simple-card.o

obj-$(CONFIG_SND_SIMPLE_CARD) += snd-soc-simple-card.o
97 changes: 97 additions & 0 deletions sound/soc/generic/simple-card-utils.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*
* simple-card-core.c
*
* Copyright (c) 2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/of.h>
#include <sound/simple_card_utils.h>

int asoc_simple_card_parse_daifmt(struct device *dev,
struct device_node *node,
struct device_node *codec,
char *prefix,
unsigned int *retfmt)
{
struct device_node *bitclkmaster = NULL;
struct device_node *framemaster = NULL;
int prefix_len = prefix ? strlen(prefix) : 0;
unsigned int daifmt;

daifmt = snd_soc_of_parse_daifmt(node, prefix,
&bitclkmaster, &framemaster);
daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK;

if (prefix_len && !bitclkmaster && !framemaster) {
/*
* No dai-link level and master setting was not found from
* sound node level, revert back to legacy DT parsing and
* take the settings from codec node.
*/
dev_dbg(dev, "Revert to legacy daifmt parsing\n");

daifmt = snd_soc_of_parse_daifmt(codec, NULL, NULL, NULL) |
(daifmt & ~SND_SOC_DAIFMT_CLOCK_MASK);
} else {
if (codec == bitclkmaster)
daifmt |= (codec == framemaster) ?
SND_SOC_DAIFMT_CBM_CFM : SND_SOC_DAIFMT_CBM_CFS;
else
daifmt |= (codec == framemaster) ?
SND_SOC_DAIFMT_CBS_CFM : SND_SOC_DAIFMT_CBS_CFS;
}

of_node_put(bitclkmaster);
of_node_put(framemaster);

*retfmt = daifmt;

return 0;
}
EXPORT_SYMBOL_GPL(asoc_simple_card_parse_daifmt);

int asoc_simple_card_set_dailink_name(struct device *dev,
struct snd_soc_dai_link *dai_link,
const char *fmt, ...)
{
va_list ap;
char *name = NULL;
int ret = -ENOMEM;

va_start(ap, fmt);
name = devm_kvasprintf(dev, GFP_KERNEL, fmt, ap);
va_end(ap);

if (name) {
ret = 0;

dai_link->name = name;
dai_link->stream_name = name;
}

return ret;
}
EXPORT_SYMBOL_GPL(asoc_simple_card_set_dailink_name);

int asoc_simple_card_parse_card_name(struct snd_soc_card *card,
char *prefix)
{
char prop[128];
int ret;

snprintf(prop, sizeof(prop), "%sname", prefix);

/* Parse the card name from DT */
ret = snd_soc_of_parse_card_name(card, prop);
if (ret < 0)
return ret;

if (!card->name && card->dai_link)
card->name = card->dai_link->name;

return 0;
}
EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_name);
Loading

0 comments on commit f341378

Please sign in to comment.