From patchwork Thu Jan 15 08:03:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 5637381 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6BDBF9F2ED for ; Thu, 15 Jan 2015 08:05:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 672F52015A for ; Thu, 15 Jan 2015 08:05:11 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 032F120149 for ; Thu, 15 Jan 2015 08:05:10 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 3CE69260420; Thu, 15 Jan 2015 09:05:09 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id DF135260487; Thu, 15 Jan 2015 09:04:26 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 2AC6C260487; Thu, 15 Jan 2015 09:04:26 +0100 (CET) Received: from relmlie2.idc.renesas.com (relmlor3.renesas.com [210.160.252.173]) by alsa0.perex.cz (Postfix) with ESMTP id 511A32604D3 for ; Thu, 15 Jan 2015 09:03:26 +0100 (CET) Received: from unknown (HELO relmlir1.idc.renesas.com) ([10.200.68.151]) by relmlie2.idc.renesas.com with ESMTP; 15 Jan 2015 17:03:24 +0900 Received: from relmlac4.idc.renesas.com (relmlac4.idc.renesas.com [10.200.69.24]) by relmlir1.idc.renesas.com (Postfix) with ESMTP id E0CE44BBB6; Thu, 15 Jan 2015 17:03:24 +0900 (JST) Received: by relmlac4.idc.renesas.com (Postfix, from userid 0) id DA866480A3; Thu, 15 Jan 2015 17:03:24 +0900 (JST) Received: from relmlac4.idc.renesas.com (localhost [127.0.0.1]) by relmlac4.idc.renesas.com (Postfix) with ESMTP id D379148014; Thu, 15 Jan 2015 17:03:24 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac4.idc.renesas.com with ESMTP id TAV15552; Thu, 15 Jan 2015 17:03:24 +0900 X-IronPort-AV: E=Sophos;i="5.09,402,1418050800"; d="scan'208";a="178816310" Received: from mail-hk1lp0119.outbound.protection.outlook.com (HELO APAC01-HK1-obe.outbound.protection.outlook.com) ([207.46.51.119]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 15 Jan 2015 17:03:24 +0900 Received: from remon.renesas.com (211.11.155.132) by SINPR06MB171.apcprd06.prod.outlook.com (10.242.57.18) with Microsoft SMTP Server (TLS) id 15.1.53.17; Thu, 15 Jan 2015 08:03:22 +0000 Message-ID: <877fwov5ak.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.14.0 Emacs/23.3 Mule/6.0 To: Mark Brown In-Reply-To: <87bnm0v5d0.wl%kuninori.morimoto.gx@renesas.com> References: <87bnm0v5d0.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Date: Thu, 15 Jan 2015 08:03:22 +0000 X-Originating-IP: [211.11.155.132] X-ClientProxiedBy: SG2PR03CA0032.apcprd03.prod.outlook.com (25.160.233.42) To SINPR06MB171.apcprd06.prod.outlook.com (10.242.57.18) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; X-DmarcAction-Test: None X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(3005004);SRVR:SINPR06MB171; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004); SRVR:SINPR06MB171; X-Forefront-PRVS: 0457F11EAF X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(199003)(189002)(53416004)(50466002)(97736003)(122386002)(40100003)(42186005)(83506001)(229853001)(2950100001)(110136001)(62966003)(77156002)(68736005)(92566002)(77096005)(36756003)(33646002)(106356001)(105586002)(46102003)(69596002)(19580395003)(19580405001)(86362001)(81156004)(50986999)(76176999)(54356999)(101416001)(87976001)(47776003)(64706001)(66066001)(23726002)(46406003); DIR:OUT; SFP:1102; SCL:1; SRVR:SINPR06MB171; H:remon.renesas.com; FPR:; SPF:None; MLV:sfv; PTR:InfoNoRecords; A:1; MX:1; LANG:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:;SRVR:SINPR06MB171; X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jan 2015 08:03:22.5490 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SINPR06MB171 Cc: Linux-ALSA , Simon , Liam Girdwood Subject: [alsa-devel] [PATCH 03/16] ASoC: rsnd: rsnd_mod controls clock X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kuninori Morimoto Current rsnd driver's mod (= ssi/src/dvc) have each own clk, but, these are needed to start/stop each mod. This patch adds struct clk in rsnd_mod, and start/stop these via rsnd_mod_hw_start/stop() macro Signed-off-by: Kuninori Morimoto --- sound/soc/sh/rcar/core.c | 2 ++ sound/soc/sh/rcar/dvc.c | 12 ++++-------- sound/soc/sh/rcar/rsnd.h | 4 ++++ sound/soc/sh/rcar/src.c | 8 +++----- sound/soc/sh/rcar/ssi.c | 8 +++----- 5 files changed, 16 insertions(+), 18 deletions(-) diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index d9c81cd..766bd4c 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -152,6 +152,7 @@ char *rsnd_mod_dma_name(struct rsnd_mod *mod) void rsnd_mod_init(struct rsnd_priv *priv, struct rsnd_mod *mod, struct rsnd_mod_ops *ops, + struct clk *clk, enum rsnd_mod_type type, int id) { @@ -159,6 +160,7 @@ void rsnd_mod_init(struct rsnd_priv *priv, mod->id = id; mod->ops = ops; mod->type = type; + mod->clk = clk; } /* diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c index 5380a48..77cb008 100644 --- a/sound/soc/sh/rcar/dvc.c +++ b/sound/soc/sh/rcar/dvc.c @@ -17,7 +17,6 @@ struct rsnd_dvc { struct rsnd_dvc_platform_info *info; /* rcar_snd.h */ struct rsnd_mod mod; - struct clk *clk; struct rsnd_kctrl_cfg_m volume; struct rsnd_kctrl_cfg_m mute; struct rsnd_kctrl_cfg_s ren; /* Ramp Enable */ @@ -132,7 +131,6 @@ static int rsnd_dvc_probe_gen2(struct rsnd_mod *mod, static int rsnd_dvc_init(struct rsnd_mod *dvc_mod, struct rsnd_dai *rdai) { - struct rsnd_dvc *dvc = rsnd_mod_to_dvc(dvc_mod); struct rsnd_dai_stream *io = rsnd_mod_to_io(dvc_mod); struct rsnd_priv *priv = rsnd_mod_to_priv(dvc_mod); struct rsnd_mod *src_mod = rsnd_io_to_mod_src(io); @@ -153,7 +151,7 @@ static int rsnd_dvc_init(struct rsnd_mod *dvc_mod, return -EINVAL; } - clk_prepare_enable(dvc->clk); + rsnd_mod_hw_start(dvc_mod); /* * fixme @@ -181,9 +179,7 @@ static int rsnd_dvc_init(struct rsnd_mod *dvc_mod, static int rsnd_dvc_quit(struct rsnd_mod *mod, struct rsnd_dai *rdai) { - struct rsnd_dvc *dvc = rsnd_mod_to_dvc(mod); - - clk_disable_unprepare(dvc->clk); + rsnd_mod_hw_stop(mod); return 0; } @@ -356,9 +352,9 @@ int rsnd_dvc_probe(struct platform_device *pdev, return PTR_ERR(clk); dvc->info = &info->dvc_info[i]; - dvc->clk = clk; - rsnd_mod_init(priv, &dvc->mod, &rsnd_dvc_ops, RSND_MOD_DVC, i); + rsnd_mod_init(priv, &dvc->mod, &rsnd_dvc_ops, + clk, RSND_MOD_DVC, i); dev_dbg(dev, "CMD%d probed\n", i); } diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h index ff191cf..d8c3117 100644 --- a/sound/soc/sh/rcar/rsnd.h +++ b/sound/soc/sh/rcar/rsnd.h @@ -226,6 +226,7 @@ struct rsnd_mod { struct rsnd_mod_ops *ops; struct rsnd_dma dma; struct rsnd_dai_stream *io; + struct clk *clk; u32 status; }; /* @@ -261,10 +262,13 @@ struct rsnd_mod { #define rsnd_dma_to_mod(_dma) container_of((_dma), struct rsnd_mod, dma) #define rsnd_mod_to_io(mod) ((mod)->io) #define rsnd_mod_id(mod) ((mod)->id) +#define rsnd_mod_hw_start(mod) clk_prepare_enable((mod)->clk) +#define rsnd_mod_hw_stop(mod) clk_disable_unprepare((mod)->clk) void rsnd_mod_init(struct rsnd_priv *priv, struct rsnd_mod *mod, struct rsnd_mod_ops *ops, + struct clk *clk, enum rsnd_mod_type type, int id); char *rsnd_mod_name(struct rsnd_mod *mod); diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c index 648b35e..6a3fd8d 100644 --- a/sound/soc/sh/rcar/src.c +++ b/sound/soc/sh/rcar/src.c @@ -22,7 +22,6 @@ struct rsnd_src { struct rsnd_src_platform_info *info; /* rcar_snd.h */ struct rsnd_mod mod; - struct clk *clk; int err; }; @@ -286,7 +285,7 @@ static int rsnd_src_init(struct rsnd_mod *mod, { struct rsnd_src *src = rsnd_mod_to_src(mod); - clk_prepare_enable(src->clk); + rsnd_mod_hw_start(mod); src->err = 0; @@ -306,7 +305,7 @@ static int rsnd_src_quit(struct rsnd_mod *mod, struct rsnd_priv *priv = rsnd_mod_to_priv(mod); struct device *dev = rsnd_priv_to_dev(priv); - clk_disable_unprepare(src->clk); + rsnd_mod_hw_stop(mod); if (src->err) dev_warn(dev, "src under/over flow err = %d\n", src->err); @@ -902,9 +901,8 @@ int rsnd_src_probe(struct platform_device *pdev, return PTR_ERR(clk); src->info = &info->src_info[i]; - src->clk = clk; - rsnd_mod_init(priv, &src->mod, ops, RSND_MOD_SRC, i); + rsnd_mod_init(priv, &src->mod, ops, clk, RSND_MOD_SRC, i); dev_dbg(dev, "SRC%d probed\n", i); } diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c index df10585..a55b963 100644 --- a/sound/soc/sh/rcar/ssi.c +++ b/sound/soc/sh/rcar/ssi.c @@ -60,7 +60,6 @@ #define SSI_NAME "ssi" struct rsnd_ssi { - struct clk *clk; struct rsnd_ssi_platform_info *info; /* rcar_snd.h */ struct rsnd_ssi *parent; struct rsnd_mod mod; @@ -188,7 +187,7 @@ static void rsnd_ssi_hw_start(struct rsnd_ssi *ssi, u32 cr; if (0 == ssi->usrcnt) { - clk_prepare_enable(ssi->clk); + rsnd_mod_hw_start(&ssi->mod); if (rsnd_dai_is_clk_master(rdai)) { if (rsnd_ssi_clk_from_parent(ssi)) @@ -260,7 +259,7 @@ static void rsnd_ssi_hw_stop(struct rsnd_ssi *ssi, rsnd_ssi_master_clk_stop(ssi); } - clk_disable_unprepare(ssi->clk); + rsnd_mod_hw_stop(&ssi->mod); } dev_dbg(dev, "%s[%d] hw stopped\n", @@ -731,7 +730,6 @@ int rsnd_ssi_probe(struct platform_device *pdev, return PTR_ERR(clk); ssi->info = pinfo; - ssi->clk = clk; ops = &rsnd_ssi_non_ops; if (pinfo->dma_id > 0) @@ -739,7 +737,7 @@ int rsnd_ssi_probe(struct platform_device *pdev, else if (rsnd_ssi_pio_available(ssi)) ops = &rsnd_ssi_pio_ops; - rsnd_mod_init(priv, &ssi->mod, ops, RSND_MOD_SSI, i); + rsnd_mod_init(priv, &ssi->mod, ops, clk, RSND_MOD_SSI, i); rsnd_ssi_parent_clk_setup(priv, ssi); }