From patchwork Fri Jun 6 07:41:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bo Shen X-Patchwork-Id: 4310531 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 75181BEEAA for ; Fri, 6 Jun 2014 07:42:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 619D9201DD for ; Fri, 6 Jun 2014 07:42:35 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id C2F042013D for ; Fri, 6 Jun 2014 07:42:33 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 7B70A2656F5; Fri, 6 Jun 2014 09:42:32 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: 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 B74232651EC; Fri, 6 Jun 2014 09:42:26 +0200 (CEST) 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 429C82651FF; Fri, 6 Jun 2014 09:42:26 +0200 (CEST) Received: from DVREDG01.corp.atmel.com (nasmtp01.atmel.com [192.199.1.245]) by alsa0.perex.cz (Postfix) with ESMTP id 8B37D2651CF for ; Fri, 6 Jun 2014 09:42:17 +0200 (CEST) Received: from sjogate2.atmel.com (10.42.103.223) by DVREDG01.corp.atmel.com (10.42.103.30) with Microsoft SMTP Server id 14.2.347.0; Fri, 6 Jun 2014 01:41:56 -0600 Received: from Dev4Android.corp.atmel.com ([10.217.2.46]) by sjogate2.atmel.com (8.13.6/8.13.6) with ESMTP id s567YG4l018102; Fri, 6 Jun 2014 00:34:17 -0700 (PDT) From: Bo Shen To: Date: Fri, 6 Jun 2014 15:41:34 +0800 Message-ID: <1402040495-10320-1-git-send-email-voice.shen@atmel.com> X-Mailer: git-send-email 1.8.5.2 MIME-Version: 1.0 Cc: Bo Shen , alsa-devel@alsa-project.org, nicolas.ferre@atmel.com, linux-arm-kernel@lists.infradead.org, linux-sound@vger.kernel.org Subject: [alsa-devel] [PATCH 1/2] misc: atmel-ssc: support to read ssc version 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 Read SSC IP version to check whether it supports frame sync length extension feature. Signed-off-by: Bo Shen --- 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