From patchwork Fri Nov 11 11:29:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 9423657 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AD90560484 for ; Fri, 11 Nov 2016 20:47:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A0E20296BE for ; Fri, 11 Nov 2016 20:47:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 932E52973E; Fri, 11 Nov 2016 20:47:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 524A7296BE for ; Fri, 11 Nov 2016 20:47:42 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 84F0F266DA0; Fri, 11 Nov 2016 21:47:41 +0100 (CET) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id B8833266DA5; Fri, 11 Nov 2016 21:45:22 +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 7B1B02659AA; Fri, 11 Nov 2016 12:30:01 +0100 (CET) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0108.outbound.protection.outlook.com [104.47.1.108]) by alsa0.perex.cz (Postfix) with ESMTP id 3A78D2606F8 for ; Fri, 11 Nov 2016 12:29:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentiatech.onmicrosoft.com; s=selector1-axentia-se; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=E03VSoT5LpLsxizJV4j16uPtxswtnJq65OMCyFZn0c0=; b=EMKkgvFOme95V+j9LkznrmbPNvKQDI190tkb171VsOZX94fBCc8vlnDwI9Q9qAQYgx6MAgKwJIvImbaHHioCH5EGp9xDt8GIms/kn6IGV4bqZVDlHdrzJJPFIvh3Zwln1FKsxHVgYHlV95peNjX+XGRqe1g190qHURzJxY8HuQg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=peda@axentia.se; Received: from localhost.localdomain (217.210.101.82) by AM5PR0201MB2305.eurprd02.prod.outlook.com (10.169.242.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.707.6; Fri, 11 Nov 2016 11:29:51 +0000 From: Peter Rosin To: Date: Fri, 11 Nov 2016 12:29:10 +0100 Message-ID: <1478863752-10569-2-git-send-email-peda@axentia.se> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1478863752-10569-1-git-send-email-peda@axentia.se> References: <1478863752-10569-1-git-send-email-peda@axentia.se> MIME-Version: 1.0 X-Originating-IP: [217.210.101.82] X-ClientProxiedBy: DB5PR08CA0008.eurprd08.prod.outlook.com (10.163.102.146) To AM5PR0201MB2305.eurprd02.prod.outlook.com (10.169.242.149) X-Microsoft-Exchange-Diagnostics: 1; AM5PR0201MB2305; 2:TnP75kuKLnqtFpdrQ/qBCzCamQk7OU1VebNESG2vVyIzyeuDml5xCt0XHX/TcwP0YsP4MOjN5jnliRpv+f9XW/9B/4HBOXNuDZ4dEVrCBHoiN+hfJ1mybKgQTJsawTTQZNrtoK92VSHrImHQNpkYOJlHSVNOYvdD3PZO2cPb1v8=; 3:kbcFmFstSCWKy/1Ovn8GEddWX6YAAkRAWxOWOP3D9K5FD1/6inab3I69m3aSbjigC2FiJfIAyBUedc/+HAQFyL0UpUEStCRj4LVR5JM70y/HZJvG/f20xTJMDKdNxvaqic+GCSzRfwJ5Mq4aH2UBhqy0lfP8DeUUuM3MxIe0zqo= X-MS-Office365-Filtering-Correlation-Id: 5191b84b-9e99-4fff-bbdc-08d40a260e4b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:AM5PR0201MB2305; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0201MB2305; 25:EG2I4bS6qL5SPLVd8wkZkJXCyrrn8zmWidp/ISzQa4LAXv/Ye+IsJmx/O1Yfq9k0sXvwSErYVzZRwdudWh6RNkYL0JGMgxkH8wrpz4L2YrWsw4Vk5hfzI9MK7RbDfRV1gypBA+2U9M4WMTJcnd0DW3SQp+tYKC5i5IDYfaD0Xpc2ZL9Uvs6gITN0j2qVFDcydMoABbVKvQV9XIKFF1QtL1o7E8qNrwXf/Nm83zJF2qDAjWfPEgfrLeBB474UZyDKfDINlbL37PdYzO5irt+t+RBA91Io3AfuNxhiCkFvWOSlhkpRjUQSV3y9iDoNj9YO8/JOsviqxC1vlBu9jWGKIjM36dMTHp7g3Rh8K25+b4Nh32v+y2vggedmK2HFKfuOZ8lZ5YGzXuUNS5XrEGUg/e6G0gHkV8ny3MkcDAil/FvMF3iM2DyUnpKomS/sv+qOuMO3HLMJ32XI7b3EObHY50dHoDvYMKg8gyzJV04/853nWY0qi/vhQl9iJnMozvl1L6HKba7ES6r8xO6tRV0eI3GNlECj+z+a2C7ZcSB8o3Hx+1dAtnmztwgeUvlbWqfU9HYokD6QNE4g74mgOc+gULrFyZ3SWbkQ9Jx9ndYEUAesejoakWlzpE2N05baxUa30F1hl7BhOQWTAmCV3obi5YQVmTGAtn8gqym8xukwjq68/zdJYNAZgnXr4uwgrJ7OXdWzfQIbCW5kPLA3ErGFOIxNwbspHKqRRDoA3MRSnj0hxN8ry72zH545LFVtwo5N X-Microsoft-Exchange-Diagnostics: 1; AM5PR0201MB2305; 31:Z3y8SBqmLMrypzRm8/26UC7bHkwwEk6LLO9r1O3nMI9EITWLTwepMeMuH5JXpA2EJ42urKbp2bEAA+HuGPdFts3adm7UDF+Gsn/ESNZmnIHkFKIftM9Tpp/Rf/HO90RofnmCttwvMhXjPT2JHm6PF+ErOh5LJ03+DSsw5rYXLiff3/pDI8WjlorV3FYXpX7E2h0Iam+DX5ZkNSO1eSoX1MwcHPKO8X948mfI2LjoVriFHTwtAMe7xhvKPZTfRVN+5vraPVCJ+6dkFIMcmcGDyA==; 4:2L3zNFuKomd8u6n3rpD8HjPLn1ww+SNFbYT4eBgeDXp4WT/RNo2E4qd1afLIozC7bLUvqak+OkZZUBMcD/Hi4AS4E5PV0NKJJeDdTnsLW/DDfXctm2vMvIBqRN511fQ4RudDwun6nF0FoRXprfxo/lDRSn0EnxLCbmQc4HG4Fs0uDA+PLnS5ZRXS8TpBWLfmdtCIalYl9BVQXDzhgMybeD5HWmNscMFKBceYk8avz5iUmdbQ3RQY9WzKbLNuOOZE8zgF6qb8E+SCcUrpG45gFdm+sZ7psS+r76oAzb5WHo76fT+CIAYMYsvOSfjGLLi2ajiAXWXbX6wY08Ff2U2GI5LBLW4Ny8FyNB5aAOo5Gv7nC749gcACcpVvA6ACvD2vrU0Pbpn6XwfomcWAnDcq3WpUimfb5dPcaM+jelfQQLZrqM6uBZM4IWhSRGAWU3tu X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6060305)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6061300)(6043046); SRVR:AM5PR0201MB2305; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0201MB2305; X-Forefront-PRVS: 012349AD1C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(6069001)(7916002)(189002)(199003)(101416001)(7416002)(8676002)(6116002)(106356001)(36756003)(6916009)(66066001)(5660300001)(68736007)(47776003)(2351001)(50226002)(3846002)(76176999)(50986999)(97736004)(586003)(77096005)(189998001)(74482002)(42186005)(2906002)(4326007)(92566002)(81166006)(81156014)(7846002)(5003940100001)(305945005)(6666003)(110136003)(50466002)(2950100002)(105586002)(7736002)(33646002)(86362001)(48376002)(42262002); DIR:OUT; SFP:1102; SCL:1; SRVR:AM5PR0201MB2305; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: axentia.se does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM5PR0201MB2305; 23:R1a9Qy2+BSI91W6pCKhjGCbmjSvxe1L2wi088sk?= =?us-ascii?Q?imF5jjTTy28wQC5po4ohS8fUcePfI1WA5QiKImrZ2xoJgngovqhFd0qs8elu?= =?us-ascii?Q?Tua5GZXNEcq5MtEEiMvwrfrdEjkNioi4VWDOvBpcFbSu44jTuvf5nPWCIA1p?= =?us-ascii?Q?5GFymKWhsnZZEPSyrmb1cs2rteghbq5YsufdYFTJMRVr5/OE0mpfwcbiAD2z?= =?us-ascii?Q?QFGPjTtrvqalsr7ak5LlfEC4KhHGKWCxHNmnd+78NNUHI/HtCwqJoIQ8oQhE?= =?us-ascii?Q?IBoCsixpjOsUJ1HvDQGEer5PsA9/OIqeE/FjafPlUhrBv1DxaLwLVwqI3WIw?= =?us-ascii?Q?Ofk9mEJN7AA99sJVvNzZwsshEPc90EwfEoCbQgwEy+2WPRKO19oAcer5lker?= =?us-ascii?Q?WrGO5VwtlRaJndejsDoZqjwe0LPr2kDd/1GDr9H2rhyVCcYfBs5wVgwxEtl+?= =?us-ascii?Q?w6wm70xgChFL1q8N5IKNYu61A9teneIKj7cKF2HaQH12Oq62AP6Qs1gd1K/w?= =?us-ascii?Q?zJ14CQ+VZEuXCgjNX9uFDeykZRvQqhq97Xm3PO1Dlu7nXxW3D4KtpwZSenDi?= =?us-ascii?Q?ilgDwr0VpsN/pZXGRea4ow00x8vpoBasmdFhCQzKb18O/C6LtILK38gOy+Eb?= =?us-ascii?Q?XRvYkP0DkMQyjF7KFYQO5MQrwEpr+HwxUNbi5L7vyMh1tW5eVQwCIRlYwU9H?= =?us-ascii?Q?Gcs6c0LOEgmrk5ZPTBZfpqgs1vO+KJ7rC147ZcgvPtZ+EiulGygczDU3JlEP?= =?us-ascii?Q?IIa7VE6m8k7bBykJR4yv8Vif8wPwmGVyxtnTlJNg2ke6BeGI75Otaeeil2LG?= =?us-ascii?Q?BdGf8kC6ZurHtq8isbWOyFHb8kCrsmkW8Or4H6bNsBLHsfNo2k0dp8hOQtOL?= =?us-ascii?Q?tyiznOEzM6oqQddmkIQmJAfkZ3etJC1G5Fv7jEodWjPxuIA8MXa3VVC//nPR?= =?us-ascii?Q?AynIMCjbIcVpxPjI6Lmi2wQaTFUnZUDUSwTAUWVGww0fmtSITn8GfjF9kU34?= =?us-ascii?Q?CrQd5BiYlf5GK7q+YuYwgRFQdNPtmUS6RM6tD4F3ZLcma1l2XVV8kfo6Udoo?= =?us-ascii?Q?WuEEYLAKtfOA07bHXtckrpvnuUB3st8Cuc3qsGXNHHY7nNKvDgQ=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; AM5PR0201MB2305; 6:URPkD2Ou3BtcX1o7oCUqhuEgrN/GVEwDGIDxQQYVXrStS8rt8dluC8UAMyIfATbOS/kox9d0qbGx7sIeztWPxnlalLs7wKdyhxNDbGy+saoi0JeIwLKSaT0x7Kt5dudP181loDa2VU/kSfB9zpD2eAK1LKP5qYtICDab0tZcX/S1aTQClVMMUzdYxWSkUmx1pEHIPW6dX2KR8xVmYgzvorDFbheZZVhrAEXO748fxEsRlfKSyQLvmERpYd5QTMYntVD1EK8sJrFDOYdRa0yO/7j73xpVTmpAs551V72zo5i3PIqhi2+oJpMzzA/yUvfFPlkhvfpDWGcEKVpvBrRlNjhQ0Y4w2CvbnHPYzXH/K0Q=; 5:Lfi6XvZcO8t+BtOvWgRXw0+VIYOpNGvDmbW/HVqWi2zM6na81QtpGF+MaT/xsC1x5UTbonfwplKHNXG3KJHQvTwgx4xW3jJAnIAH9RAhjcxWVAWKxknoChR+VXKD2ApSSE9Hj2856y0RuIMYCm8czwc6xX7WGa44VOeq53BU074=; 24:VqpN3anjDHgLtCAeq9rfxDsqolh3SKLMGsxtgskzjgaBA68FYYoathk9arKp8TJNJgJ6ix3j95VtHtIVDvp51jW4k6gM+ljvykjjPXReG14= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM5PR0201MB2305; 7:jMVtCGJ4lZK2x2P91zrijxlcV/QHgkn+Y7U2avKzgeJBem8xjafHFcgPOxnfkLnlDJ4v95Xk0bSAbWVZEYaMXqANN0T1Dyi85B/VXpHZzWJAVrkWpMCrIJ2/MqifXI0CUkXE7jPtAc1zBsDqGd4baYdNsmP4hPjy2/72jgrLL99adkPcLqqoKabC/zEfSjLesVwx+8H/VJnIEC0TmM2pK/xjnDOcAaLx2TJEei6pgpsQ7UEs8q2uXdgmOXnYucmmaeCED4zoN9gckT+Zq6SbrQrRAnPuIjG9mezqyMz1PLwnhNgJKj5CX0mVQAtcjoGsJ2e4uv8cwPyk5f6JcpxiQcuic8qpHIzPndQOIFScwm8= X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2016 11:29:51.5819 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0201MB2305 Cc: Mark Rutland , devicetree@vger.kernel.org, alsa-devel@alsa-project.org, Takashi Iwai , Nicolas Ferre , Liam Girdwood , Rob Herring , Mark Brown , Peter Rosin Subject: [alsa-devel] [PATCH v3 1/3] ASoC: atmel_ssc_dai: if not provided, default to sensible dividers 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 When this driver masters BCLK and/or LRCLK, and noone has stated differently, assume that all the bits of a frame are used. This relieves the cpu dai users from the duty to fill in the dividers for the common case. Signed-off-by: Peter Rosin --- sound/soc/atmel/atmel_ssc_dai.c | 83 +++++++++++++++++++++++++++++++++++++---- sound/soc/atmel/atmel_ssc_dai.h | 1 + 2 files changed, 77 insertions(+), 7 deletions(-) diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c index 16e459aedffe..a1e2c5682dcd 100644 --- a/sound/soc/atmel/atmel_ssc_dai.c +++ b/sound/soc/atmel/atmel_ssc_dai.c @@ -380,6 +380,7 @@ static void atmel_ssc_shutdown(struct snd_pcm_substream *substream, ssc_writel(ssc_p->ssc->regs, CR, SSC_BIT(CR_SWRST)); /* Clear the SSC dividers */ ssc_p->cmr_div = ssc_p->tcmr_period = ssc_p->rcmr_period = 0; + ssc_p->forced_divider = 0; } spin_unlock_irq(&ssc_p->lock); @@ -426,14 +427,17 @@ static int atmel_ssc_set_dai_clkdiv(struct snd_soc_dai *cpu_dai, else if (div != ssc_p->cmr_div) return -EBUSY; + ssc_p->forced_divider |= BIT(ATMEL_SSC_CMR_DIV); break; case ATMEL_SSC_TCMR_PERIOD: ssc_p->tcmr_period = div; + ssc_p->forced_divider |= BIT(ATMEL_SSC_TCMR_PERIOD); break; case ATMEL_SSC_RCMR_PERIOD: ssc_p->rcmr_period = div; + ssc_p->forced_divider |= BIT(ATMEL_SSC_RCMR_PERIOD); break; default: @@ -443,6 +447,28 @@ static int atmel_ssc_set_dai_clkdiv(struct snd_soc_dai *cpu_dai, return 0; } +/* Is the cpu-dai master of the frame clock? */ +static int atmel_ssc_cfs(struct atmel_ssc_info *ssc_p) +{ + switch (ssc_p->daifmt & SND_SOC_DAIFMT_MASTER_MASK) { + case SND_SOC_DAIFMT_CBM_CFS: + case SND_SOC_DAIFMT_CBS_CFS: + return 1; + } + return 0; +} + +/* Is the cpu-dai master of the bit clock? */ +static int atmel_ssc_cbs(struct atmel_ssc_info *ssc_p) +{ + switch (ssc_p->daifmt & SND_SOC_DAIFMT_MASTER_MASK) { + case SND_SOC_DAIFMT_CBS_CFM: + case SND_SOC_DAIFMT_CBS_CFS: + return 1; + } + return 0; +} + /* * Configure the SSC. */ @@ -459,6 +485,9 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, u32 tfmr, rfmr, tcmr, rcmr; int ret; int fslen, fslen_ext; + u32 cmr_div; + u32 tcmr_period; + u32 rcmr_period; /* * Currently, there is only one set of dma params for @@ -470,6 +499,46 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, else dir = 1; + /* + * If the cpu dai should provide BCLK, but noone has provided the + * divider needed for that to work, fall back to something sensible. + */ + cmr_div = ssc_p->cmr_div; + if (!(ssc_p->forced_divider & BIT(ATMEL_SSC_CMR_DIV)) && + atmel_ssc_cbs(ssc_p)) { + int bclk_rate = snd_soc_params_to_bclk(params); + + if (bclk_rate < 0) { + dev_err(dai->dev, "unable to calculate cmr_div: %d\n", + bclk_rate); + return bclk_rate; + } + + cmr_div = DIV_ROUND_CLOSEST(ssc_p->mck_rate, 2 * bclk_rate); + } + + /* + * If the cpu dai should provide LRCLK, but noone has provided the + * dividers needed for that to work, fall back to something sensible. + */ + tcmr_period = ssc_p->tcmr_period; + rcmr_period = ssc_p->rcmr_period; + if (atmel_ssc_cfs(ssc_p)) { + int frame_size = snd_soc_params_to_frame_size(params); + + if (frame_size < 0) { + dev_err(dai->dev, + "unable to calculate tx/rx cmr_period: %d\n", + frame_size); + return frame_size; + } + + if (!(ssc_p->forced_divider & BIT(ATMEL_SSC_TCMR_PERIOD))) + tcmr_period = frame_size / 2 - 1; + if (!(ssc_p->forced_divider & BIT(ATMEL_SSC_RCMR_PERIOD))) + rcmr_period = frame_size / 2 - 1; + } + dma_params = ssc_p->dma_params[dir]; channels = params_channels(params); @@ -524,7 +593,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, fslen_ext = (bits - 1) / 16; fslen = (bits - 1) % 16; - rcmr = SSC_BF(RCMR_PERIOD, ssc_p->rcmr_period) + rcmr = SSC_BF(RCMR_PERIOD, rcmr_period) | SSC_BF(RCMR_STTDLY, START_DELAY) | SSC_BF(RCMR_START, SSC_START_FALLING_RF) | SSC_BF(RCMR_CKI, SSC_CKI_RISING) @@ -540,7 +609,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, | SSC_BF(RFMR_LOOP, 0) | SSC_BF(RFMR_DATLEN, (bits - 1)); - tcmr = SSC_BF(TCMR_PERIOD, ssc_p->tcmr_period) + tcmr = SSC_BF(TCMR_PERIOD, tcmr_period) | SSC_BF(TCMR_STTDLY, START_DELAY) | SSC_BF(TCMR_START, SSC_START_FALLING_RF) | SSC_BF(TCMR_CKI, SSC_CKI_FALLING) @@ -606,7 +675,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, fslen_ext = (bits - 1) / 16; fslen = (bits - 1) % 16; - rcmr = SSC_BF(RCMR_PERIOD, ssc_p->rcmr_period) + rcmr = SSC_BF(RCMR_PERIOD, rcmr_period) | SSC_BF(RCMR_STTDLY, START_DELAY) | SSC_BF(RCMR_START, SSC_START_FALLING_RF) | SSC_BF(RCMR_CKI, SSC_CKI_RISING) @@ -623,7 +692,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, | SSC_BF(RFMR_LOOP, 0) | SSC_BF(RFMR_DATLEN, (bits - 1)); - tcmr = SSC_BF(TCMR_PERIOD, ssc_p->tcmr_period) + tcmr = SSC_BF(TCMR_PERIOD, tcmr_period) | SSC_BF(TCMR_STTDLY, START_DELAY) | SSC_BF(TCMR_START, SSC_START_FALLING_RF) | SSC_BF(TCMR_CKI, SSC_CKI_FALLING) @@ -650,7 +719,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, * MCK divider, and the BCLK signal is output * on the SSC TK line. */ - rcmr = SSC_BF(RCMR_PERIOD, ssc_p->rcmr_period) + rcmr = SSC_BF(RCMR_PERIOD, rcmr_period) | SSC_BF(RCMR_STTDLY, 1) | SSC_BF(RCMR_START, SSC_START_RISING_RF) | SSC_BF(RCMR_CKI, SSC_CKI_RISING) @@ -665,7 +734,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, | SSC_BF(RFMR_LOOP, 0) | SSC_BF(RFMR_DATLEN, (bits - 1)); - tcmr = SSC_BF(TCMR_PERIOD, ssc_p->tcmr_period) + tcmr = SSC_BF(TCMR_PERIOD, tcmr_period) | SSC_BF(TCMR_STTDLY, 1) | SSC_BF(TCMR_START, SSC_START_RISING_RF) | SSC_BF(TCMR_CKI, SSC_CKI_FALLING) @@ -760,7 +829,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, } /* set SSC clock mode register */ - ssc_writel(ssc_p->ssc->regs, CMR, ssc_p->cmr_div); + ssc_writel(ssc_p->ssc->regs, CMR, cmr_div); /* set receive clock mode and format */ ssc_writel(ssc_p->ssc->regs, RCMR, rcmr); diff --git a/sound/soc/atmel/atmel_ssc_dai.h b/sound/soc/atmel/atmel_ssc_dai.h index 80b153857a88..75194f582131 100644 --- a/sound/soc/atmel/atmel_ssc_dai.h +++ b/sound/soc/atmel/atmel_ssc_dai.h @@ -113,6 +113,7 @@ struct atmel_ssc_info { unsigned short cmr_div; unsigned short tcmr_period; unsigned short rcmr_period; + unsigned int forced_divider; struct atmel_pcm_dma_params *dma_params[2]; struct atmel_ssc_state ssc_state; unsigned long mck_rate;