1
0
Fork 0
Commit Graph

337 Commits (redonkable)

Author SHA1 Message Date
Kuninori Morimoto 29a43aa9b4 ASoC: simple_card_utils: tidyup file comment/define
simple_card_utils was created as simple_card_core in 1st prototype,
and current code still have it. Let's tidyup

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-12-05 11:37:45 +00:00
Kuninori Morimoto 6c1c06cb77 ASoC: simple-card-utils: remove unnecessary cpu/codec pointer check
Remove cpu/codec pointer check from asoc_simple_card_canonicalize_dailink()
This is verbose check, and will be issue if CPU name was created by
fmt_single_name() on simple-scu-card.c.
see also asoc_simple_card_canonicalize_cpu()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-10-28 19:24:48 +01:00
Kuninori Morimoto 193599264f ASoC: simple-scu-card: code sync: tidyup props/link naming
simple sound card family are using very similar style, but because of its
historical reason, there are small differences. For example pointer style,
function name, caller postion etc...
This patch synchronizes style to other simple card family so that be enable
to easy reviewing.

This patch uses dai_link/dai_props instead of links/props.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-10-28 19:24:48 +01:00
Kuninori Morimoto 6910e8679f ASoC: simple-scu-card: code sync: rename asoc_simple_card_priv
simple sound card family are using very similar style, but because of its
historical reason, there are small differences. For example pointer style,
function name, caller postion etc...
This patch synchronized simple card style to other simple card family

This patch renames asoc_simple_card_priv to simple_card_data,
same as other simple card family.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-10-28 19:24:24 +01:00
Kuninori Morimoto 15a190ffec ASoC: simple-scu-card: code sync: follow to simple family style
simple sound card family are using very similar style, but because of its
historical reason, there are small differences. For example pointer style,
function name, caller postion etc...
This patch synchronized simple card style to other simple card family

Current simple-scu-card function naming is different from other simple card
family. And related to it, the necessary operation position is also
different. This patch synchronize these to other simple card family.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-10-28 19:23:41 +01:00
Julia Lawall 9b6fdef62b ASoC: constify snd_soc_ops structures
Check for snd_soc_ops structures that are only stored in the ops field of a
snd_soc_dai_link structure.  This field is declared const, so snd_soc_ops
structures that have this property can be declared as const also.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct snd_soc_ops i@p = { ... };

@ok1@
identifier r.i;
struct snd_soc_dai_link e;
position p;
@@
e.ops = &i@p;

@ok2@
identifier r.i, e;
position p;
@@
struct snd_soc_dai_link e[] = { ..., { .ops = &i@p, }, ..., };

@bad@
position p != {r.p,ok1.p,ok2.p};
identifier r.i;
struct snd_soc_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct snd_soc_ops i = { ... };
// </smpl>

The effect on the layout of the .o files is shown by the following output
of the size command, first before then after the transformation:

   text    data     bss     dec     hex filename
   4500     696       0    5196    144c sound/soc/generic/simple-card.o
   4564     632       0    5196    144c sound/soc/generic/simple-card.o

   text    data     bss     dec     hex filename
   3018     608       0    3626     e2a sound/soc/generic/simple-scu-card.o
   3074     544       0    3618     e22 sound/soc/generic/simple-scu-card.o

   text    data     bss     dec     hex filename
   4148    2448     768    7364    1cc4 sound/soc/intel/boards/bdw-rt5677.o
   4212    2384     768    7364    1cc4 sound/soc/intel/boards/bdw-rt5677.o

   text    data     bss     dec     hex filename
   5403    4628     384   10415    28af sound/soc/intel/boards/bxt_da7219_max98357a.o
   5531    4516     384   10431    28bf sound/soc/intel/boards/bxt_da7219_max98357a.o

   text    data     bss     dec     hex filename
   5275    4496     384   10155    27ab sound/soc/intel/boards/bxt_rt298.o
   5403    4368     384   10155    27ab sound/soc/intel/boards/bxt_rt298.o

   text    data     bss     dec     hex filename
  10017    2344      48   12409    3079 sound/soc/intel/boards/bytcr_rt5640.o
  10145    2232      48   12425    3089 sound/soc/intel/boards/bytcr_rt5640.o

   text    data     bss     dec     hex filename
   3719    2356       0    6075    17bb sound/soc/intel/boards/bytcr_rt5651.o
   3847    2244       0    6091    17cb sound/soc/intel/boards/bytcr_rt5651.o

   text    data     bss     dec     hex filename
   3598    2392       0    5990    1766 sound/soc/intel/boards/cht_bsw_max98090_ti.o
   3726    2280       0    6006    1776 sound/soc/intel/boards/cht_bsw_max98090_ti.o

   text    data     bss     dec     hex filename
   5343    3624      16    8983    2317 sound/soc/intel/boards/cht_bsw_rt5645.o
   5471    3496      16    8983    2317 sound/soc/intel/boards/cht_bsw_rt5645.o

   text    data     bss     dec     hex filename
   4662    2592     384    7638    1dd6 sound/soc/intel/boards/cht_bsw_rt5672.o
   4790    2464     384    7638    1dd6 sound/soc/intel/boards/cht_bsw_rt5672.o

   text    data     bss     dec     hex filename
   1595    2528       0    4123    101b sound/soc/intel/boards/haswell.o
   1659    2472       0    4131    1023 sound/soc/intel/boards/haswell.o

   text    data     bss     dec     hex filename
   6272    4760     416   11448    2cb8 sound/soc/intel/boards/skl_nau88l25_max98357a.o
   6464    4568     416   11448    2cb8 sound/soc/intel/boards/skl_nau88l25_max98357a.o

   text    data     bss     dec     hex filename
   7075    4888     416   12379    305b sound/soc/intel/boards/skl_nau88l25_ssm4567.o
   7267    4696     416   12379    305b sound/soc/intel/boards/skl_nau88l25_ssm4567.o

   text    data     bss     dec     hex filename
   5659    4496     384   10539    292b sound/soc/intel/boards/skl_rt286.o
   5787    4368     384   10539    292b sound/soc/intel/boards/skl_rt286.o

   text    data     bss     dec     hex filename
   1721    2048       0    3769     eb9 sound/soc/kirkwood/armada-370-db.o
   1769    1976       0    3745     ea1 sound/soc/kirkwood/armada-370-db.o

   text    data     bss     dec     hex filename
   1363    1792       0    3155     c53 sound/soc/mxs/mxs-sgtl5000.o
   1427    1728       0    3155     c53 sound/soc/mxs/mxs-sgtl5000.o

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-10-24 18:34:55 +01:00
Mark Brown 5b56b9bb6c Merge remote-tracking branches 'asoc/topic/sgtl5000', 'asoc/topic/simple', 'asoc/topic/stac9766', 'asoc/topic/sti' and 'asoc/topic/sunxi' into asoc-next 2016-09-29 12:44:41 -07:00
Marek Vasut 97b4bc76d9 ASoC: trivial: system spelling fix
Do s/ststem/system/ .

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-28 09:49:47 -07:00
Nikita Yushchenko 899a247cf6 ASoC: simple-card: add support for aux devices
Add device tree property to define auxiliary devices to be added to
simle-audio-card.

Together with proper audio routing definition, this allows to use
simple-card in setups where separate amplifier chip is connected to
codec's output.

Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-26 09:04:14 -07:00
Kuninori Morimoto b0133d9c4d ASoC: simple-card: use kzalloc() for dai_props / dai_link
simple sound card family are using very similar style, but because of its
historical reason, there are small differences. For example pointer style,
function name, caller postion etc...
This patch synchronized simple card style to other simple card family.

Now, simple card needs to 2 type of buffer for dai_props and dai_link.
But, these used different style for buffer allocation.
This patch make these same style as other simple card family.
(= use kzalloc() for both)

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-01 21:22:59 +01:00
Kuninori Morimoto 2c86dda74c ASoC: simple-card: code sync: rename num_link to num
simple sound card family are using very similar style, but because of its
historical reason, there are small differences. For example pointer style,
function name, caller postion etc...
This patch synchronized simple card style to other simple card family.

This patch renames num_link to num

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-01 21:22:59 +01:00
Kuninori Morimoto 0a6c7f2f78 ASoC: simple-card: code sync: use tag
simple sound card family are using very similar style, but because of its
historical reason, there are small differences. For example pointer style,
function name, caller postion etc...
This patch synchronized simple card style to other simple card family.

This patch uses tag on asoc_simple_card_probe

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-01 21:22:59 +01:00
Kuninori Morimoto 387f5823f4 ASoC: simple-card: code sync: tidyup white line
simple sound card family are using very similar style, but because of its
historical reason, there are small differences. For example pointer style,
function name, caller postion etc...
This patch synchronized simple card style to other simple card family.

This patch tidyups white line

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-01 21:22:59 +01:00
Kuninori Morimoto a1dbfd0013 ASoC: simple-card: is GPL v2
It is indicating that this driver is GPL v2 on top of C code.
Let's fixup it on MODULE_LICENSE()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-01 21:22:59 +01:00
Kuninori Morimoto c9a23ead02 ASoC: simple-card: code sync: use simple_priv_to_props() macro
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-01 21:22:59 +01:00
Kuninori Morimoto 7e3353ddd2 ASoC: simple-card: code sync: tidyup simple_priv_to_xxx() macro
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-01 21:22:59 +01:00
Kuninori Morimoto f93b646d51 ASoC: simple-card: tidyup mclk-fs of_property_read_u32() usage
of_property_read_u32() do nothing in error case.
Let's tidyup useless usage.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-01 21:22:59 +01:00
Kuninori Morimoto a03b0545c2 ASoC: simple-card: call of_node_put() for dai_link
We need to call of_node_put() if we used of_get_child_by_name(),
but missing it for "dai-link" loop.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-01 21:22:59 +01:00
Kuninori Morimoto 9f645421b8 ASoC: simple-scu-card: code sync: tidyup TDM setting position
simple sound card family are using very similar style, but because of its
historical reason, there are small differences. For example pointer style,
function name, caller postion etc...
This patch tidyup TDM setting position

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-01 21:21:39 +01:00
Kuninori Morimoto f4d70709c8 ASoC: simple-scu-card: code sync: move asoc_simple_card_of_match
simple sound card family are using very similar style, but because of its
historical reason, there are small differences. For example pointer style,
function name, caller postion etc...
This patch synchronized simple card style to other simple card family

This patch moves asoc_simple_card_of_match to bottom side, and rename
it to asoc_simple_of_match same as other simple card family.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-01 21:21:39 +01:00
Kuninori Morimoto 88da724f77 ASoC: simple-scu-card: depends on CONFIG_OF
simple-scu-card driver is under CONFIG_OF. This patch adds missing
config.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-01 21:21:39 +01:00
Kuninori Morimoto 83216f3acc ASoC: simple-scu-card: tidyup asoc_simple_card_parse_links() method
Current asoc_simple_card_parse_links() is setting dai_link daifmt.
But, asoc_simple_card_parse_links() is doing it.
This patch clean-up this point less method

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-01 21:21:39 +01:00
Kuninori Morimoto 112a2ab5a7 ASoC: simple-scu-card: tidyup codec daifmt handling method
Current simple-scu-card is handling codec daifmt by using
for_each_child_of_node(), and low-level method.
Let's use of_get_child_by_name() instead it

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-01 21:21:39 +01:00
Kuninori Morimoto 93bc047d76 ASoC: simple-scu-card: is GPL v2
It is indicating that this driver is GPL v2 on top of C code.
Let's fixup it on MODULE_LICENSE()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-01 21:21:39 +01:00
Kuninori Morimoto 5496ca5c65 ASoC: simple-scu-card: remove unused definitions
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-01 21:21:39 +01:00
Kuninori Morimoto d12c6216c4 ASoC: rsrc-card: rename rsrc-card to simple-scu-card phase3
rsrc-card which is using DPCM feature was created for Renesas sound.
But not only Renesas, but many SoC can use this driver, because
it is based on simple-card driver.
To use it as more open driver, rsrc-card will be renamed to
simple-scu-card. In order to easy patch review, as 3rd step,
this patch moves rsrc-card driver to generic folder.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-24 11:19:16 +01:00
Kuninori Morimoto 885fc0595a ASoC: simple-card: use asoc_simple_card_clean_reference()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-10 21:03:25 +01:00
Kuninori Morimoto 0f4e0711b7 ASoC: simple-card-utils: add asoc_simple_card_clean_reference()
simple-card needs to decrease the reference count of the device nodes.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-10 21:03:25 +01:00
Kuninori Morimoto 16f1de6f36 ASoC: simple-card: use asoc_simple_card_canonicalize_cpu()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-10 21:03:25 +01:00
Kuninori Morimoto 983cebd602 ASoC: simple-card-utils: add asoc_simple_card_canonicalize_cpu()
simple-card needs remove dai_link->cpu_dai_name if it CPU was
single DAI.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-10 21:03:25 +01:00
Kuninori Morimoto c958374f1c ASoC: simple-card: use asoc_simple_card_canonicalize_dailink()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-09 12:43:55 +01:00
Kuninori Morimoto c262c9ab7a ASoC: simple-card-utils: add asoc_simple_card_canonicalize_dailink()
simple-card is assuming that sometimes platform and cpu are same.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-09 12:43:55 +01:00
Kuninori Morimoto d8cb9354c8 ASoC: simple-card: use asoc_simple_card_init_dai()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-09 12:43:55 +01:00
Kuninori Morimoto 21ba62f849 ASoC: simple-card-utils: add asoc_simple_card_init_dai()
simple-card is supporting clock/tdm slot initialization.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-09 12:43:55 +01:00
Kuninori Morimoto c3b19c8dd0 ASoC: simple-card: remove asoc_simple_card_sub_parse_of()
asoc_simple_card_sub_parse_of() is no longer needed. Let's cleanup

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-08 11:35:51 +01:00
Kuninori Morimoto 44c16af1fa ASoC: simple-card: use asoc_simple_card_parse_dai()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-08 11:35:51 +01:00
Kuninori Morimoto ae30a694da ASoC: simple-card-utils: add asoc_simple_card_parse_dai()
simple-card needs to get its dai name and endpoint node.
This patch makes it simple style standard

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-08 11:35:51 +01:00
Kuninori Morimoto bb6fc620c2 ASoC: simple-card-utils: add asoc_simple_card_parse_clk()
Current simple-card can get clock via DT clocks or
"system-clock-frequency" property.
This patch makes it simple style standard

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-08 11:35:51 +01:00
Mark Brown bc0ba64db9 Merge branch 'fix/simple' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-simple 2016-08-08 11:35:14 +01:00
Kuninori Morimoto 28abd99b6e ASoC: simple-card: use asoc_simple_card_parse_clk()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-05 12:31:37 +01:00
Kuninori Morimoto 1f85e118c8 ASoC: simple-card-utils: add missing MODULE_xxx()
simple-card-utils might be used as module, but MODULE_xxx()
information was missed. This patch adds it.
Otherwise, we will have below error, and can't use it.
Specil thanks to Kevin.

> insmod simple-card-utils.ko
simple_card_utils: module license 'unspecified' taints kernel.
Disabling lock debugging due to kernel taint
simple_card_utils: Unknown symbol snd_soc_of_parse_daifmt (err 0)
simple_card_utils: Unknown symbol snd_soc_of_parse_card_name (err 0)
insmod: can't insert 'simple-card-utils.ko': \
	unknown symbol in module, or unknown parameter

Reported-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-03 19:16:59 +01:00
Kuninori Morimoto 3527d85b85 ASoC: simple-card: use asoc_simple_card_parse_card_name()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-07-16 13:03:04 +01:00
Kuninori Morimoto fc55c9b5a2 ASoC: simple-card-utils: add asoc_simple_card_parse_card_name()
simple-card needs to get its card name.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-07-16 13:03:04 +01:00
Kuninori Morimoto 2e8d1c7d54 ASoC: simple-card: use asoc_simple_card_parse_dailink_name()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-07-16 13:03:01 +01:00
Kuninori Morimoto 1db3312e3a ASoC: simple-card-utils: add asoc_simple_card_set_dailink_name()
Current simple-card is creating dai_link->name / dai_link->stream_name.
These are based on CPU + Codec name, or "fe.CPU" or "be.Codec" if it
was DPCM.
This patch adds asoc_simple_card_set_dailink_name() and set dailink
name as common method.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-07-16 13:03:01 +01:00
Kuninori Morimoto cecdef3656 ASoC: simple-card: use asoc_simple_card_parse_daifmt()
We can use simpel utils asoc_simple_card_parse_daifmt().
Let's use it

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-07-01 17:34:02 +02:00
Kuninori Morimoto abd3147e69 ASoC: add new simple-card-utils.c
Current ALSA SoC has simple-card driver which is supporting both
platform and DT probe.
Now, some sound cards driver are created based on simple-card.
They have similar feature or function, but implemented separately
on each drivers. This is a waste of code.
OTOH, merging these driver into same driver is highly risk,
because it will be very difficult to keep compatibility.
More over, ALSA SoC want to have graph base of DT feature in the
future. Maybe it want to use simple-card like feature / function.
Because of these background, this patch creates simple-card
helper utils, and provides common function to each drivers.
1st is asoc_simple_card_parse_daifmt()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-06-29 19:12:30 +01:00
Kuninori Morimoto 9eac361877 ASoC: simple-card: add new asoc_simple_jack and use it
Current simple-card supports snd_soc_jack/pin/gpio.
These code are very similar, but driver has verbosity code.
So, this patch adds new snd_soc_jack and cleanups code

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-06-29 19:12:30 +01:00
Kuninori Morimoto 548563fa3e ASoC: simple-card: use common PREFIX for each DT property
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-06-13 13:24:54 +01:00
Kuninori Morimoto 5fb9cb1651 ASoC: simple-card: platform also uses asoc_simple_card_sub_parse_of()
In current simple-card, platform is handled as special case,
but, the code is not readable.
This patch makes platform to use asoc_simple_card_sub_parse_of()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-05-30 17:16:19 +01:00
Peter Ujfalusi 7c3767115a ASoC: simple-card: Add pm callbacks to platform driver
Set snd_soc_pm_ops for the pm ops to make sure that the ASoC level of PM
operations are going to happen. This is needed to get suspend/resume
working correctly when the audio is using simple-card.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-05-09 16:24:16 +01:00
Aaro Koskinen ee43a1a0cd ASoC: simple-card: don't fail if sysclk setting is not supported
Commit e22579713a ("ASoC: simple card: set cpu-dai sysclk
with mclk-fs") added sysclk / SND_SOC_CLOCK_OUT setting, that makes
asoc_simple_card_hw_params fail if the operation is not supported,
although the intention clearly was to ignore ENOTSUPP. Fix it.

The patch fixes audio playback on Kirkwood / OpenRD client,
where the following errors are seen:

	asoc-simple-card sound: ASoC: machine hw_params failed: -524
	alsa-lib: /alsa-lib-1.0.28/src/pcm/pcm_hw.c:327:(snd_pcm_hw_hw_params) SNDRV_PCM_IOCTL_HW_PARAMS failed (-524): Unknown error 524

Fixes: e22579713a ("ASoC: simple card: set cpu-dai sysclk with mclk-fs")
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-27 20:27:09 +00:00
Mengdong Lin 1a497983a5 ASoC: Change the PCM runtime array to a list
Currently the number of DAI links is statically defined by the machine
driver at build time using an array. This makes it difficult to shrink/
grow the number of DAI links at runtime in order to reflect any changes
in topology.

We can change the DAI link array in the core to a list so that PCMs and
FE DAI links can be added and deleted at runtime to reflect changes in
use case and DSP topology. The machine driver can still register DAI links
as an array.

As the 1st step, this patch change the PCM runtime array to a list. A new
PCM runtime is added to the list when a DAI link is bound successfully.

Later patches will further implement the DAI link list.

More:
- define snd_soc_new/free_pcm_runtime() to create/free a runtime.
- define soc_add_pcm_runtime() to add a runtime to the rtd list.
- define soc_remove_pcm_runtimes() to clean up the runtime list.

- traverse the rtd list to probe the link components and dais.

- Add a field "num" to PCM runtime struct, used to specify the device
  number when creating the pcm device, and for a soc card to access
  its dai_props array.

- The following 3rd party machine/platform drivers iterate the rtd list
  to check the runtimes:
  sound/soc/intel/atom/sst-mfld-platform-pcm.c
  sound/soc/intel/boards/cht_bsw_rt5645.c
  sound/soc/intel/boards/cht_bsw_rt5672.c
  sound/soc/intel/boards/cht_bsw_max98090_ti.c

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-18 18:32:24 +00:00
Jyri Sarha 6131084a0b ASoC: simple-card: Add tdm slot mask support to simple-card
Adds DT binding for explicitly choosing a tdm mask for DAI and uses it
in simple-card. The API for snd_soc_of_parse_tdm_slot() has also been
changed.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-16 18:00:30 +01:00
Arnaud Pouliquen e22579713a ASoC: simple card: set cpu-dai sysclk with mclk-fs
Allows to request a specific mclk frequency per cpu_dai.
To support some codecs with mclk provided by the cpu_dai, the
mclk rate must be set depending on frame rate.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-07 12:52:56 +01:00
Arnaud Pouliquen 85a4bfd895 ASoC: simple card: Add mclk-fs property in dai-link
Add mclk-fs ratio property per dai-link sub node. This will
allow to manage several codecs with different ratio.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-12 12:35:54 +01:00
Jun Nie e0ae225b7e ASoC: simple-card: support platform in dts parse
Support platform in dts parse so that dma pcm component
can be added in dts.

Signed-off-by: Jun Nie <jun.nie@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-04 14:59:04 +01:00
Mark Brown e3438187d2 Merge remote-tracking branches 'asoc/topic/rt5641', 'asoc/topic/rt5677' and 'asoc/topic/sh-cleanup' into asoc-next 2015-04-12 19:49:17 +01:00
Lars-Peter Clausen 1efb53a220 ASoC: simple-card: Remove support for setting differing DAI formats
Having to set different formats on the CPU side and the CODEC side of a DAI
link is usually indication that something is terribly wrong and in most
cases is a result of a broken driver that implements a set_fmt() callback
which does not follow the specification. In the past this feature has been
used to work around broken drivers, rather than fixing them. We don't really
want to encourage this, so remove support for setting different formats on
both ends of the link.

Along the way switch to static DAI format setup by setting the the dai_fmt
field of the snd_soc_dai_link rather than calling snd_soc_dai_fmt().

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-03-26 18:35:48 -07:00
Mark Brown 256fca9247 Merge remote-tracking branches 'asoc/topic/jack', 'asoc/topic/max98357a', 'asoc/topic/omap' and 'asoc/topic/rt286' into asoc-next 2015-03-05 01:07:23 +00:00
Lars-Peter Clausen 386669fcec ASoC: simple-card: Register jacks at the card level
The jacks are card level elements so use snd_soc_card_jack_new() instead of
snd_soc_jack_new() to register them.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-03-04 17:09:51 +00:00
Vishal Thanki 31f3032c1a ASoC: simple-card: Add a NULL pointer check in asoc_simple_card_dai_link_of
Make sure devm_kzalloc() succeeds.

Signed-off-by: Vishal Thanki <vishalthanki@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-03-03 14:25:16 +00:00
Mark Brown 1bf9f29a05 Merge remote-tracking branches 'asoc/topic/simple', 'asoc/topic/sta32x', 'asoc/topic/tdm-slot', 'asoc/topic/tegra' and 'asoc/topic/tlv320aic3x' into asoc-next 2015-02-09 15:10:29 +08:00
Mark Brown cb6bfd3de4 Merge remote-tracking branches 'asoc/topic/rx51', 'asoc/topic/samsung', 'asoc/topic/sh', 'asoc/topic/simple' and 'asoc/topic/sta32x' into asoc-next 2015-02-04 20:57:18 +00:00
Jyri Sarha f9911803e8 ASoC: simple-card: Enable and disable DAI clocks as needed
Call clk_prepare_enable() and clk_disable_unprepare() for cpu dai
clock and codec dai clock in dai statup and shutdown callbacks. This
to make sure the related clock are enabled when the audio device is
used.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-01-15 11:45:52 +00:00
Geert Uytterhoeven 7ddfdb5c5a ASoC: simple-card: Fix crash in asoc_simple_card_unref()
If asoc_simple_card_probe() fails, asoc_simple_card_unref() may be
called before dev_set_drvdata(), causing a NULL pointer dereference in
asoc_simple_card_unref():

    Unable to handle kernel NULL pointer dereference at virtual address 000000d4
    ...
    PC is at asoc_simple_card_unref+0x14/0x48
    LR is at asoc_simple_card_probe+0x3d4/0x40c

This typically happens because asoc_simple_card_parse_of() returns
-EPROBE_DEFER, but other failure modes are possible.
devm_snd_soc_register_card()/snd_soc_register_card() may fail either
before or after dev_set_drvdata().

Pass a snd_soc_card pointer instead of a platform_device pointer to
asoc_simple_card_unref() to fix this.

Note that if CONFIG_OF_DYNAMIC=n, of_node_put() is a dummy, and gcc may
optimize away the loop over card->dai_link, never actually dereferencing
card, and thus avoiding the crash...

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Fixes: e512e001da ("ASoC: simple-card: Fix the reference count of device nodes")
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
2015-01-14 17:16:37 +00:00
Linus Torvalds e6b5be2be4 Driver core patches for 3.19-rc1
Here's the set of driver core patches for 3.19-rc1.
 
 They are dominated by the removal of the .owner field in platform
 drivers.  They touch a lot of files, but they are "simple" changes, just
 removing a line in a structure.
 
 Other than that, a few minor driver core and debugfs changes.  There are
 some ath9k patches coming in through this tree that have been acked by
 the wireless maintainers as they relied on the debugfs changes.
 
 Everything has been in linux-next for a while.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iEYEABECAAYFAlSOD20ACgkQMUfUDdst+ylLPACg2QrW1oHhdTMT9WI8jihlHVRM
 53kAoLeteByQ3iVwWurwwseRPiWa8+MI
 =OVRS
 -----END PGP SIGNATURE-----

Merge tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core update from Greg KH:
 "Here's the set of driver core patches for 3.19-rc1.

  They are dominated by the removal of the .owner field in platform
  drivers.  They touch a lot of files, but they are "simple" changes,
  just removing a line in a structure.

  Other than that, a few minor driver core and debugfs changes.  There
  are some ath9k patches coming in through this tree that have been
  acked by the wireless maintainers as they relied on the debugfs
  changes.

  Everything has been in linux-next for a while"

* tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (324 commits)
  Revert "ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries"
  fs: debugfs: add forward declaration for struct device type
  firmware class: Deletion of an unnecessary check before the function call "vunmap"
  firmware loader: fix hung task warning dump
  devcoredump: provide a one-way disable function
  device: Add dev_<level>_once variants
  ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries
  ath: use seq_file api for ath9k debugfs files
  debugfs: add helper function to create device related seq_file
  drivers/base: cacheinfo: remove noisy error boot message
  Revert "core: platform: add warning if driver has no owner"
  drivers: base: support cpu cache information interface to userspace via sysfs
  drivers: base: add cpu_device_create to support per-cpu devices
  topology: replace custom attribute macros with standard DEVICE_ATTR*
  cpumask: factor out show_cpumap into separate helper function
  driver core: Fix unbalanced device reference in drivers_probe
  driver core: fix race with userland in device_add()
  sysfs/kernfs: make read requests on pre-alloc files use the buffer.
  sysfs/kernfs: allow attributes to request write buffer be pre-allocated.
  fs: sysfs: return EGBIG on write if offset is larger than file size
  ...
2014-12-14 16:10:09 -08:00
Jean-Francois Moine 7195d920bd ASoC: simple-card: Remove useless function argument
The device node pointer 'cpu' is not used in the function
asoc_simple_card_parse_daifmt().

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-25 13:49:33 +00:00
Jean-Francois Moine 0099c76285 ASoC: simple-card: Remove useless casts
There is no need to cast the cpu_of_node or codec_of_node of the
dai_links when calling of_put_node.

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-10 19:02:02 +00:00
Jianqun 4476159f0b ASoC: simple-card: add "invert" property for detect GPIOs
Since hardware may invert detect GPIO of headphone or mic, add one
property to support software invert.

Signed-off-by: Jianqun <jay.xu@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-03 12:26:15 +00:00
Kuninori Morimoto 1b5721b243 ASoC: simple-card: add asoc_simple_card_parse_daifmt()
Current daifmt setting method in simple-card driver is
placed to many places, and using un-readable/confusable method.
This patch adds new asoc_simple_card_parse_daifmt()
and tidyup code.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-28 16:35:51 +00:00
Wolfram Sang ffd35fa74f ASoC: generic: drop owner assignment from platform_drivers
A platform_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-10-20 16:22:08 +02:00
Fabio Estevam 84d4cbe9a6 ASoC: simple-card: Delete unneeded test before of_node_put
of_node_put() supports NULL as its argument, so the initial test is not
necessary.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-20 12:22:40 +01:00
Geert Uytterhoeven 2dbab9784d ASoC: simple-card: Initialize headphone and mic GPIO numbers
The uninitialized default of 0 for gpio_hp_det and gpio_mic_det doesn't
play well with asm-generic's gpio_is_valid():

	static inline bool gpio_is_valid(int number)
	{
		return number >= 0 && number < ARCH_NR_GPIOS;
	}

Hence on r8a7740/armadillo-legacy:

	sh-mobile-hdmi sh-mobile-hdmi: SH Mobile HDMI Audio Codec
	sh-mobile-hdmi sh-mobile-hdmi: ASoC: DAPM unknown pin Headphones
	sh-mobile-hdmi sh-mobile-hdmi: ASoC: DAPM unknown pin Mic Jack

After that the kernel log is spammed ca. 7 times per second with:

	sh-mobile-hdmi sh-mobile-hdmi: ASoC: DAPM unknown pin Headphones

Initialize the GPIO numbers with a negative number (-ENOENT) to fix this.

Fixes: 3fe240326c ("ASoC: simple-card: Add mic and hp detect gpios.")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-07 18:24:01 +01:00
Dylan Reid 3fe240326c ASoC: simple-card: Add mic and hp detect gpios.
Allow Headphone and Microphone jack detect gpios to be specified in
device tree.  This will allow a few systems including rk3288_max98090
to use simple-card instead of having their own board file.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-02 16:53:40 +01:00
Mark Brown 04a0b8ef6b Linux 3.17-rc4
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJUDOW+AAoJEHm+PkMAQRiGOXYH/00TPKm8PdM5cXXG2YYYv9eT
 W99K7KD2i0/qiVtlGgjjvB7fO3K0HcZusTd2jmVd8IWntXvauq7Zpw5YZkjwu4KX
 Y1HCwwCd2aw0FoqgrJhNP3+j5Cr1BD/HLtbffjCe+A3tppOIis4Bwt2wJOoYlXpS
 hU9Jxxc4lcRo8YKbffouDo7PIneWeJy8N+WGpUR5BfJIEK0ZZtCUqn3/3WLX4FYu
 fE6uiF/bACTpKXU/mo4dDbhZp439H/QdwQc9B0F8+8CBDMXKaNHrPV7kN36T2SWa
 fD4boikTsi/yh9Ks1fvHbvNq2N0ihoMnja+vLRyvjAcAQv2fKG3OZtYgFWSdghU=
 =Xknd
 -----END PGP SIGNATURE-----

Merge tag 'v3.17-rc4' into asoc-simple

Linux 3.17-rc4
2014-10-02 16:53:35 +01:00
Kuninori Morimoto 9810f5370b ASoC: simple-card: tidyup get dai_link/dai_props from priv
It can get dai_link/dai_props pointer from priv + index

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-12 15:00:58 +01:00
Kuninori Morimoto f531913f01 ASoC: simple-card: tidyup use priv in parameter
priv has many information about simple-card driver.
Using it becomes easy to extend feature.
This patch gets dev from priv as 1st step

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-12 14:59:48 +01:00
Arnd Bergmann 88a60e552f ASoC: simple-card: fix regression in clock rate lookup
Commit 7c7b9cf53d ("ASoC: simple-card: fixup cpu_dai_name
clear case") changed the way that "sound-dai" properties are handled,
which leads to the clock frequency not being picked up from the
node that the phandle points to, as correctly identified by gcc
with this warning:

sound/soc/generic/simple-card.c: In function 'asoc_simple_card_sub_parse_of':
sound/soc/generic/simple-card.c:165:7: warning: 'node' may be used uninitialized in this function [-Wmaybe-uninitialized]

This restores the previous behavior by using the node from
of_parse_phandle_with_args() that was previously being
returned from of_parse_phandle().

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-10 11:56:42 +01:00
Xiubo Li 0dd4fc3c2f ASoC: simple-card: Adjust the comments of simple card.
Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-10 11:52:37 +01:00
Xiubo Li 2080437d37 ASoC: simple-card: Merge single and muti DAI link(s) code.
This patch will split the DT node into old style and new style:
The new style will merge the single DAI link and muti DAI links code
together, the new style will be easier to add muti DAI links from old
single DAI link DTs.

This patch will maintian compatibility with the old DTs.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-09-09 12:59:49 +01:00
Kuninori Morimoto 7c7b9cf53d ASoC: simple-card: fixup cpu_dai_name clear case
f687d900d3
(ASoC: simple-card: cpu_dai_name creates confusion when DT case)
cleared cpu_dai_name for caring fmt_single_name case,
and
179949bc04
(ASoC: simple-card: remove dai_link->cpu_dai_name when DT)
cared multi dai-link case.
but, cpu_dai_name matching is required when fmt_multiple_name was used

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-03 13:53:44 +01:00
Xiubo Li e3c4a28b61 ASoC: simple-card: Fix bug of wrong decrement DT node's refcount
DAI links's cpu_of_node's and codec_of_node's refcounts shouldn't
be decremented immediately at the end of the probe() fucntion.
Because we will still use them before the audio card is removed.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-01 17:48:07 +01:00
Kuninori Morimoto a44a750e52 ASoC: simple-card: use common for_each_child_of_node() for loop
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-08-29 12:51:02 +01:00
Kuninori Morimoto a5960bd598 ASoC: simple-card: dai_link->init should be cared when multi DAI
6a91a17bd7
(ASoC: simple-card: Handle many DAI links)
added multi DAI support on simple-card.
This means priv->dai_link might be pointer of multi DAI.
dai_link->init is needed for all DAI.
This patch cares it for all DAIs on DT/non-DT

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-08-29 12:51:02 +01:00
Kuninori Morimoto 179949bc04 ASoC: simple-card: remove dai_link->cpu_dai_name when DT
f687d900d3
(ASoC: simple-card: cpu_dai_name creates confusion when DT case)
removed dai_link->cpu_dai_name when DT case,
since it uses DT phand in soc_bind_dai_link().
This binding will fail if it has cpu_dai_name.

6a91a17bd7
(ASoC: simple-card: Handle many DAI links)
added multi DAI link support to simple-card driver.
Then, removing cpu_dai_name was cared only single DAI.
But, it is needed in all DT cases.
This patch moves it to asoc_simple_card_dai_link_of()
so that care about all DAIs.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-08-29 12:51:01 +01:00
Kuninori Morimoto 2d82eeb026 ASoC: simple-card: use asoc_simple_xxx prefix
simple-card driver is using asoc_simple_xxx() prefix.
simple_card_dai_link_of() should be
asoc_simple_card_dai_link_of().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-08-29 12:49:34 +01:00
Xiubo Li 8ea2134886 ASoC: simple-card: Fix the compile warning.
sound/soc/generic/simple-card.c: In function simple_card_dai_link_of:
sound/soc/generic/simple-card.c:198:10: warning: passing argument 3 of
asoc_simple_card_sub_parse_of from incompatible pointer type [enabled by default]
          &dai_link->cpu_dai_name);
          ^
sound/soc/generic/simple-card.c:112:1: note: expected const struct device_node **
but argument is of type struct device_node **
 asoc_simple_card_sub_parse_of(struct device_node *np,
 ^
sound/soc/generic/simple-card.c:229:10: warning: passing argument 3 of
asoc_simple_card_sub_parse_of from incompatible pointer type [enabled by default]
          &dai_link->codec_dai_name);
          ^
sound/soc/generic/simple-card.c:112:1: note: expected const struct device_node **
but argument is of type struct device_node **
 asoc_simple_card_sub_parse_of(struct device_node *np,
 ^

Since the asoc_simple_card_sub_parse_of() is used in simple-card module only,
and the third argument is just used to get the node ponters address, so there is
no need it must to be 'const' type.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-18 11:42:05 -05:00
Jyri Sarha c7099eb1c1 ASoC: simple-card: Make u32 DT parameter handling 64-bit proof
Passing unsigned int pointers as u32 ponters may be dangerous on 64-bit
system.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-21 11:06:53 +01:00
Andrew Lunn 2942a0e285 ASoC: simple-card: Support setting mclk via a fixed factor
Some platforms require that the codecs mclk is a fixed multiplication
factor of the audio stream rate. Add a optional property to the
binding to hold this factor and implement a hw_params() function to
make use of it.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-26 14:29:30 +01:00
Jyri Sarha 648722155d ASoC: simple-card: is_top_level_node parameter to simple_card_dai_link_of()
Restore correct parsing of dai-link subnodes with more explicit
implementation for applying the "simple-audio-card,"-prefix to
dai-link property and subnode names.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-24 18:23:49 +01:00
Nicolin Chen 781cbebed7 ASoC: simple-card: Improve coding style
Improve indentation and space.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-24 13:20:11 +01:00
Nicolin Chen 966b806360 ASoC: simple-card: Simplify error msg in simple_card_dai_link_of()
It would look better to use prop instead.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-24 13:20:11 +01:00
Nicolin Chen 50e6c718a1 ASoC: simple-card: Drop node->name checking
The current simple-card driver limits the DT node name to "sound".
Any of other names is forbidden while actually we should allow DT
to pass other node names.

And if this function is being called, the node must already have
the compatible "simple-audio-card" in DTB. So there should be no
need to check the name here.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-24 13:20:11 +01:00
Jyri Sarha b3ca11ff59 ASoC: simple-card: Move dai-link level properties away from dai subnodes
The properties like format, bitclock-master, frame-master,
bitclock-inversion, and frame-inversion should be common to the dais
connected with a dai-link. For bitclock-master and frame-master
properties to be unambiguous they need to indicate the mastering dai
node with a phandle.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Acked-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-23 13:14:27 +01:00
Jyri Sarha 389cb8348c ASoC: core: Update snd_soc_of_parse_daifmt() interface
Adds struct device_node **bitclkmaster and struct device_node **framemaster
function parameters. With the new syntax bitclock-master and frame-master
properties can explicitly indicate the dai-link bit-clock and frame masters
with a phandle. This patch also makes the minimal changes to simple-card
for it to work with the updated snd_soc_of_parse_daifmt(). Simple-card appears
to be the only user of snd_soc_of_parse_daifmt() for now.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Acked-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-23 13:14:27 +01:00
Jean-Francois Moine 6a91a17bd7 ASoC: simple-card: Handle many DAI links
Some simple audio cards may have many DAI links.
This patch extends the simple-card driver for handling such cards.

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-25 18:09:20 +00:00
Jean-Francois Moine cf7dc23cbf ASoC: simple-card: dynamically allocate the DAI link and properties
The DAI link array and the properties (fmt, sysclk slots) are
hard-coded for a single CPU / CODEC link.

This patch dynamically allocates the DAI link array and the
properties with the aim of supporting many DAI links.

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-25 18:09:20 +00:00
Nicolin Chen 46c39cae29 ASoC: simple-card: overwrite cpu_dai->fmt with codec_dai->fmt
The current simple-card driver separates the daimft for cpu_dai and codec_dai.
So we might get different values for them (0x4003 and 0x1003 for example):

asoc-simple-card sound-cs42888.12: cpu : 2024000.esai / 4003 / 132000000
asoc-simple-card sound-cs42888.12: codec : cs42888 / 1003 / 24576000
asoc-simple-card sound-cs42888.12: cs42888 <-> 2024000.esai mapping ok

This is not allowed at all as we need to keep the DAIFMT settings identical
for both the ends of the link.

Thus this patch fixes it by overwriting the cpu_dai->fmt with codec_dai->fmt
since we defined the DAIFMT_MASTER basing on CODEC at the first place while
the other bits are same.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-18 23:44:40 +00:00
Jean-Francois Moine c56c4d74c6 ASoC: simple-card: Simplify code
The global DAI format is used only in the function
asoc_simple_card_parse_of(). So, move it from the private data
to the stack.

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Reviewed-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-17 16:24:56 +00:00
Jean-Francois Moine e512e001da ASoC: simple-card: Fix the reference count of device nodes
The reference count of some device nodes is not correctly reset
at end of card probe.

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-14 19:56:55 +00:00
Kuninori Morimoto 12ffa6fc19 ASoC: simple-card: card name can be option
snd_card.name is now option on DT case.
non-DT case can follow same style,
and it is understandable from platform point of view.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-10 07:53:35 +00:00
Kuninori Morimoto 81985bd63f ASoC: simple-card: tidyup cpu/codec dai_fmt settings for non-DT
30d0341e7d
(ASoC: simple-card: simplify the daifmt code)
simplify cpu/codec dai_fmt which consists from
dai specific format + common format.
But, it didn't care about non-DT case.
This patch fixes it

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-05 14:10:47 +08:00
Kuninori Morimoto f687d900d3 ASoC: simple-card: cpu_dai_name creates confusion when DT case
Basically, soc_bind_dai_link() checks
cpu_dai->dev->of_node and dai_link->cpu_of_node in DT case.
But after that it will check
cpu_dai->name and dai_link->cpu_dai_name too.

On the other hand, snd_soc_dai :: name is created by
fmt_single_name() or fmt_multiple_name().

There is no confusion if dai name is created by fmt_multiple_name(),
since cpu_dai->name is same as dai_link->cpu_dai_name.
but, if dai name is created by fmt_single_name(), CPU DAI never match.

Thus, simple-card not set dai_link->cpu_dai_name if DT case
to skip naming match on soc_bind_dai_link()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-28 14:25:25 +09:00
Xiubo Li 6ff62eedce ASoC: simple-card: add slot information parsing supports
For some CPU/CODEC DAI devices the slot information maybe needed. This
patch adds the slot information parsing for simple-card driver.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-23 14:26:37 +09:00
Xiubo Li 9d681f5bfc ASoC: simple-card: add off-codec widgets supports.
Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-10 13:33:40 +00:00
Xiubo Li 2772555b6c ASoC: simple-card: Add snd_card's name parsing from DT node support
If the DT is used and the CPU DAI device has only one DAI, the card
name will be like :

ALSA device list:
0: 40031000.sai-sgtl5000

And this name maybe a little ugly to some customers, so here the
card name parsing from DT node is supported.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:45:34 +00:00
Xiubo Li 30d0341e7d ASoC: simple-card: simplify the daifmt code
In the asoc_simple_card_parse_of() will parse the device node's CPU/CODEC
DAI commone fmts, and then in asoc_simple_card_sub_parse_of() will parse
the CPU/CODEC DAI's sub-node fmts, so we can combine the info->daifmt and
info->set.fmt in asoc_simple_card_sub_parse_of() not while just before
_set_fmt().

And this will be more easy to add new functions, such as supporting
_set_tdm_slot(), etc.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:45:34 +00:00
Xiubo Li 4763ebe226 ASoC: simple-card: fix __asoc_simple_card_dai_init
If the CPU/CODEC DAI set_sysclk() is not support, the -ENOTSUPP will returnd.
Here do the check like set_fmt().

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:45:34 +00:00
Jean-Francois Moine b367a3252b ASoC: simple-card: simplify code
Rename the pointer to the private data structure to 'priv' to avoid confusion with the platform data pointer.

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:45:33 +00:00
Jean-Francois Moine 45fce59496 ASoC: simple-card: simplify code
The platform data structure contains information which is used only by
the driver, and the driver allocates platform information fields which
are of no use.
Move the driver specific data to a new private structure and cleanup
the platform data structure.

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:45:33 +00:00
Jean-Francois Moine ca65b492c7 ASoC: simple-card: simplify code
In the non-DT sequence, the platform data is copied as a whole to the
dynamic card info and the same pointer 'cinfo' is used to copy the
platform information to the card.

Use 'priv' as the pointer to the dynamic card info and copy only the
useful information from the platform data.

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:45:33 +00:00
Jean-Francois Moine 5200847292 ASoC: simple-card: simplify code
The CPU and CODEC DAI names are still copied to the user info structure.
Put them directly in the DAI links.

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:45:33 +00:00
Jean-Francois Moine 5ca8ba4180 ASoC: simple-card: simplify code
Have a cleaner code using a DAI link pointer.

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:45:33 +00:00
Jean-Francois Moine 201a0eac7f ASoC: simple-card: simplify code
The OF pointers are put in the stack and then copied to the card
descriptor.
Put them directly at their right place.

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:45:33 +00:00
Jean-Francois Moine 2bee991460 ASoC: simple-card: simplify code
The DT values are copied to the non-DT structure before being moved to
the card structure.
Set directly the DT values in the card and move the non-DT copy to the
non-DT sequence.

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:45:33 +00:00
Jean-Francois Moine 7722f830a4 ASoC: simple-card: simplify code
The check of the mandatory fields is done for DT in its specific sequence.
Move the global check to the non-DT sequence.

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:45:33 +00:00
Mark Brown 701caa51a2 Merge remote-tracking branches 'asoc/topic/adsp', 'asoc/topic/atmel', 'asoc/topic/bcm2835', 'asoc/topic/docs', 'asoc/topic/fsl', 'asoc/topic/generic', 'asoc/topic/kirkwood', 'asoc/topic/mc13783', 'asoc/topic/mxs', 'asoc/topic/nuc900', 'asoc/topic/sai', 'asoc/topic/sh', 'asoc/topic/ssm2602', 'asoc/topic/tlv320aic3x', 'asoc/topic/twl4030', 'asoc/topic/ux500', 'asoc/topic/width' and 'asoc/topic/x86' into for-tiwai 2014-01-16 12:44:01 +00:00
Xiubo Li ca919fe4b9 ASoC: simple-card: fix one bug to writing to the platform data
It's a bug that writing to the platform data directly, for it should
be constant. So just copy it before writing.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-14 21:25:48 +00:00
Xiubo Li ba194a4de5 ASoC: simple-card: use snd_soc_card_set/get_drvdata
Remove asoc_simple_get_card_info macro and use snd_soc_card_set_drvdata
and snd_soc_card_get_drvdata instead.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-13 17:38:36 +00:00
Xiubo Li 34787d0a25 ASoC: simple-card: fix the cinfo error check
If the dt is used and the cinfo is NULL, the -ENOMEM should be return.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-09 17:38:09 +00:00
Xiubo Li 708ec0241c ASoC: simple-card: fix a bug where cinfo will be NULL before using it
If the dt is not used, the cinfo will be always NULL before using it.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-09 17:35:46 +00:00
Xiubo Li 8c0b8230b2 ASoC: simple-card: keep the property's name the same pattern
Even though we might not have rigor rule for the simple card property names,
according to the existing ones, they are all in a same pattern:

[simple-audio-card,]XXX;

Rename simple-audio-routing to simple-audio-card,routing, and make the simple
card's properties has one unified name.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-07 15:43:13 +00:00
Xiubo Li f87a3e825c ASoC: simple-card: fix the DAPM routes map parsing
The simple-card's DAPM route maping is optional.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-07 15:43:13 +00:00
Xiubo Li e2a19ac6c5 ASoC: simple-card: Fix the sysclk selection.
For spdif there is no need to do the sysclk setting.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-06 15:28:50 +00:00
Mark Brown 2cde51fbd0 Merge remote-tracking branches 'asoc/topic/ad1836', 'asoc/topic/ad193x', 'asoc/topic/adav80x', 'asoc/topic/adsp', 'asoc/topic/ak4641', 'asoc/topic/ak4642', 'asoc/topic/arizona', 'asoc/topic/atmel', 'asoc/topic/au1x', 'asoc/topic/axi', 'asoc/topic/bcm2835', 'asoc/topic/blackfin', 'asoc/topic/cs4271', 'asoc/topic/cs42l52', 'asoc/topic/da7210', 'asoc/topic/davinci', 'asoc/topic/ep93xx', 'asoc/topic/fsl', 'asoc/topic/fsl-mxs', 'asoc/topic/generic', 'asoc/topic/hdmi', 'asoc/topic/jack', 'asoc/topic/jz4740', 'asoc/topic/max98090', 'asoc/topic/mxs', 'asoc/topic/omap', 'asoc/topic/pxa', 'asoc/topic/rcar', 'asoc/topic/s6000', 'asoc/topic/sai', 'asoc/topic/samsung', 'asoc/topic/sgtl5000', 'asoc/topic/spear', 'asoc/topic/ssm2518', 'asoc/topic/ssm2602', 'asoc/topic/tegra', 'asoc/topic/tlv320aic3x', 'asoc/topic/twl6040', 'asoc/topic/txx9', 'asoc/topic/uda1380', 'asoc/topic/width', 'asoc/topic/wm8510', 'asoc/topic/wm8523', 'asoc/topic/wm8580', 'asoc/topic/wm8711', 'asoc/topic/wm8728', 'asoc/topic/wm8731', 'asoc/topic/wm8741', 'asoc/topic/wm8750', 'asoc/topic/wm8753', 'asoc/topic/wm8776', 'asoc/topic/wm8804', 'asoc/topic/wm8900', 'asoc/topic/wm8901', 'asoc/topic/wm8940', 'asoc/topic/wm8962', 'asoc/topic/wm8974', 'asoc/topic/wm8985', 'asoc/topic/wm8988', 'asoc/topic/wm8990', 'asoc/topic/wm8991', 'asoc/topic/wm8994', 'asoc/topic/wm8995', 'asoc/topic/wm9081' and 'asoc/topic/x86' into asoc-next 2014-01-02 13:01:55 +00:00
Xiubo Li 71467e4641 ASoC: simple-card: Add device's module clock selection.
Try to get the device's module clock if the dt has no clocks and
system-clock-frequency properties.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-01 12:24:56 +00:00
Xiubo Li e874ddead3 ASoC: simple-card: Cleanup __asoc_simple_card_dai_init() ret check
The ret parameter is always equal to zero till here.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-31 12:48:28 +00:00
Xiubo Li d4c22094b2 ASoC: simple-card: Add DAPM routes parse from device tree
Parses a simple DAPM route table from device tree.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-31 12:38:10 +00:00
Xiubo Li dd41e0c4e3 ASoC: simple-card: Add cpu_dai and codec_dai names NULL check
The name of cpu DAI maybe omitted, and then strlen() will lead
kernel panic.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-21 14:42:48 +00:00
Xiubo Li e1acb40a3a ASoC: simple-card: Use devm_snd_soc_register_card()
Makes the code slightly shorter.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-19 10:23:04 +00:00
Kuninori Morimoto fa558c2801 ASoC: simple-card: add Device Tree support
Support for loading the simple-card module via DeviceTree.
It requests CPU/CODEC information.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-02 12:37:28 +00:00
Kuninori Morimoto e244bb9bc1 ASoC: simple-card: un-implemented set_fmt is not error
Current simple-card returns error if DAI doesn't
support .set_fmt callback.
But the error is -ENOTSUPP (= not supported),
and it is not error.
This patch avoids such case

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-10-20 17:28:02 +01:00
Fabio Estevam c445be3595 ASoC: simple-card: Provide owner and MODULE_ALIAS()
Add .owner field and also MODULE_ALIAS(), so that auto module loading can work.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-23 19:04:20 +01:00
Kuninori Morimoto a4a2992c53 ASoC: simple-card: add asoc_simple_dai for initializing
Current simple-card driver calls asoc_simple_card_dai_init()
if platform had a asoc_simple_card_dai_init pointer.
And, this initialization function works only
when platform has an applicable initial value for each dai settings.
And basically, almost all sound card requires certain initialization.
This means that almost all platform has initialization settings,
and driver do nothing if it doesn't have settings.

And additionally, current simple-card supports sysclk settings but it was
only for codec.  In order to abolish deviation between cpu and codec,
and in order to simplify processing,
this patch adds asoc_simple_dai, and removed pointless
struct asoc_simple_dai_init_info which was trigger of
calling asoc_simple_card_dai_init().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-14 06:55:43 +09:00
Kuninori Morimoto f89983ef61 ASoC: simple-card: use struct device pointer for dev_xxx()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-27 16:51:16 +00:00
Kuninori Morimoto f2390880ec ASoC: add generic simple-card support
Current ASoC requires card.c file to each platforms in order to
specifies its CPU and Codecs pair.
But the differences between these were only value/strings of setting.
In order to reduce duplicate driver, this patch adds generic/simple-card.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-13 11:29:25 +01:00