public inbox for linux-sound@vger.kernel.org
 help / color / mirror / Atom feed
From: Bo Shen <voice.shen@atmel.com>
To: broonie@kernel.org
Cc: nicolas.ferre@atmel.com, linux-sound@vger.kernel.org,
	alsa-devel@alsa-project.org,
	linux-arm-kernel@lists.infradead.org,
	Bo Shen <voice.shen@atmel.com>
Subject: [PATCH 1/2] misc: atmel-ssc: support to read ssc version
Date: Fri, 06 Jun 2014 07:41:34 +0000	[thread overview]
Message-ID: <1402040495-10320-1-git-send-email-voice.shen@atmel.com> (raw)

Read SSC IP version to check whether it supports frame sync
length extension feature.

Signed-off-by: Bo Shen <voice.shen@atmel.com>
---

 drivers/misc/atmel-ssc.c  | 7 +++++++
 include/linux/atmel-ssc.h | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
index 22de137..9f49bcb 100644
--- a/drivers/misc/atmel-ssc.c
+++ b/drivers/misc/atmel-ssc.c
@@ -136,6 +136,7 @@ static int ssc_probe(struct platform_device *pdev)
 	struct resource *regs;
 	struct ssc_device *ssc;
 	const struct atmel_ssc_platform_data *plat_dat;
+	u32 version;
 
 	ssc = devm_kzalloc(&pdev->dev, sizeof(struct ssc_device), GFP_KERNEL);
 	if (!ssc) {
@@ -173,8 +174,14 @@ static int ssc_probe(struct platform_device *pdev)
 	clk_prepare_enable(ssc->clk);
 	ssc_writel(ssc->regs, IDR, -1);
 	ssc_readl(ssc->regs, SR);
+	version = ssc_readl(ssc->regs, VERSION);
 	clk_disable_unprepare(ssc->clk);
 
+	if (version >= 0x300)
+		ssc->has_fslen_ext = 1;
+	else
+		ssc->has_fslen_ext = 0;
+
 	ssc->irq = platform_get_irq(pdev, 0);
 	if (!ssc->irq) {
 		dev_dbg(&pdev->dev, "could not get irq\n");
diff --git a/include/linux/atmel-ssc.h b/include/linux/atmel-ssc.h
index 571a12e..9ee1b68 100644
--- a/include/linux/atmel-ssc.h
+++ b/include/linux/atmel-ssc.h
@@ -19,6 +19,7 @@ struct ssc_device {
 	int			user;
 	int			irq;
 	bool			clk_from_rk_pin;
+	int			has_fslen_ext;
 };
 
 struct ssc_device * __must_check ssc_request(unsigned int ssc_num);
@@ -258,6 +259,8 @@ void ssc_free(struct ssc_device *ssc);
 #define SSC_IMR_TXSYN_SIZE			 1
 #define SSC_IMR_TXSYN_OFFSET			10
 
+#define SSC_VERSION			0x000000fc
+
 /* SSC PDC Receive Pointer Register */
 #define SSC_PDC_RPR			0x00000100
 
-- 
1.8.5.2


             reply	other threads:[~2014-06-06  7:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-06  7:41 Bo Shen [this message]
2014-06-06  7:41 ` [PATCH 2/2] ASoC: atmel_ssc_dai: enable fslen extension feature Bo Shen
2014-06-10 16:40   ` Nicolas Ferre
2014-06-10 16:32 ` [PATCH 1/2] misc: atmel-ssc: support to read ssc version Nicolas Ferre

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=1402040495-10320-1-git-send-email-voice.shen@atmel.com \
    --to=voice.shen@atmel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=nicolas.ferre@atmel.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