mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: <tony@atomide.com>, <jarkko.nikula@bitmer.com>, <paul@pwsan.com>
Cc: <t-kristo@ti.com>, <linux-omap@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>
Subject: [PATCH v2 2/3] ARM: OMAP2+: mcbsp: Prepare the device build code for sidetone hwmod removal
Date: Fri, 18 Mar 2016 16:23:26 +0200	[thread overview]
Message-ID: <1458311007-19168-3-git-send-email-peter.ujfalusi@ti.com> (raw)
In-Reply-To: <1458311007-19168-1-git-send-email-peter.ujfalusi@ti.com>

The McBSP sidetone hwmods will be removed as they should not exist because
the sidetone is a sub-block of McBSP and it is the responsibility of the
McBSP driver to handle it. It has no effect or dependency on PRCM.
When the sidetone hwmod is removed the oh->dev_attr can not be used to
determine if the McBSP port has sidetone or not, but we can use the IRQ
names. If the module has IRQ named as sidetone, the McBSP has it.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 arch/arm/mach-omap2/mcbsp.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index b4ac3af1160c..8a3c50fa6a78 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -48,6 +48,23 @@ static int omap3_enable_st_clock(unsigned int id, bool enable)
 		return omap2_clk_allow_idle(mcbsp_iclks[id]);
 }
 
+static bool omap3_mcbsp_has_st(struct omap_hwmod *oh)
+{
+	struct omap_hwmod_irq_info *ohii;
+	int i = 0;
+
+	if (!oh || !oh->mpu_irqs)
+		return false;
+
+	do {
+		ohii = &oh->mpu_irqs[i++];
+		if (!strcmp(ohii->name, "sidetone"))
+			return true;
+	} while (ohii->irq != -1);
+
+	return false;
+}
+
 static int __init omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
 {
 	int id, count = 1;
@@ -56,6 +73,7 @@ static int __init omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
 	struct omap_mcbsp_platform_data *pdata = NULL;
 	struct platform_device *pdev;
 	char clk_name[11];
+	bool has_sidetone = false;
 
 	sscanf(oh->name, "mcbsp%d", &id);
 
@@ -96,11 +114,19 @@ static int __init omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
 	if (oh->dev_attr) {
 		oh_device[1] = omap_hwmod_lookup((
 		(struct omap_mcbsp_dev_attr *)(oh->dev_attr))->sidetone);
+		count++;
+
+		has_sidetone = true;
+	} else {
+		has_sidetone = omap3_mcbsp_has_st(oh);
+	}
+
+	if (has_sidetone) {
 		pdata->enable_st_clock = omap3_enable_st_clock;
 		sprintf(clk_name, "mcbsp%d_ick", id);
 		mcbsp_iclks[id] = clk_get(NULL, clk_name);
-		count++;
 	}
+
 	pdev = omap_device_build_ss(name, id, oh_device, count, pdata,
 				    sizeof(*pdata));
 	kfree(pdata);
-- 
2.7.3

  parent reply	other threads:[~2016-03-18 14:27 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-18 14:23 [PATCH v2 0/3] ARM: OMAP3: Fix McBSP2/3 hwmod setup for sidetone Peter Ujfalusi
2016-03-18 14:23 ` [PATCH v2 1/3] ARM: DTS: omap3: Remove mcbsp2/3_sidetone hwmod reference for McBSP2/3 Peter Ujfalusi
2016-03-18 14:23 ` Peter Ujfalusi [this message]
2016-03-18 14:23 ` [PATCH v2 3/3] ARM: OMAP3: hwmod data: Merge and remove the McBSP sidetone related data Peter Ujfalusi
2016-03-19 19:38 ` [PATCH v2 0/3] ARM: OMAP3: Fix McBSP2/3 hwmod setup for sidetone Paul Walmsley
2016-03-21  8:57   ` Peter Ujfalusi
2016-03-21 17:44     ` Paul Walmsley
2016-04-01  9:33       ` Peter Ujfalusi
2016-04-02  0:17         ` Tony Lindgren
2016-04-04 12:45           ` Peter Ujfalusi
2016-04-04 15:12             ` Tony Lindgren
2016-04-05 13:15               ` Peter Ujfalusi
2016-04-11 21:28                 ` Tony Lindgren
2016-04-12  9:52                   ` Peter Ujfalusi
2016-04-12 16:37                     ` Tony Lindgren
2016-04-13 11:57                       ` Peter Ujfalusi
2016-04-13 15:28                         ` Tony Lindgren
2016-04-14  7:34                           ` Peter Ujfalusi
2016-04-14 16:55                             ` Tony Lindgren
2016-04-14 19:37                               ` Peter Ujfalusi
2016-04-14 20:34                                 ` Tony Lindgren
2016-04-15 10:23                                   ` Peter Ujfalusi
2016-04-15 15:16                                     ` Tony Lindgren
2016-04-15 19:50                                       ` Peter Ujfalusi
2016-04-18 23:51                                         ` Tony Lindgren
2016-04-22 13:12                                           ` Peter Ujfalusi
2016-04-22 22:24                                             ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1458311007-19168-3-git-send-email-peter.ujfalusi@ti.com \
    --to=peter.ujfalusi@ti.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jarkko.nikula@bitmer.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=paul@pwsan.com \
    --cc=t-kristo@ti.com \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®