From patchwork Tue May 18 20:13:11 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liam Girdwood X-Patchwork-Id: 100594 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4IKDpdL020734 for ; Tue, 18 May 2010 20:13:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753780Ab0ERUNu (ORCPT ); Tue, 18 May 2010 16:13:50 -0400 Received: from mail-ww0-f46.google.com ([74.125.82.46]:39291 "EHLO mail-ww0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754806Ab0ERUNt (ORCPT ); Tue, 18 May 2010 16:13:49 -0400 Received: by wwb22 with SMTP id 22so61884wwb.19 for ; Tue, 18 May 2010 13:13:48 -0700 (PDT) Received: by 10.227.155.135 with SMTP id s7mr6724119wbw.168.1274213628438; Tue, 18 May 2010 13:13:48 -0700 (PDT) Received: from localhost.localdomain (host81-136-218-57.in-addr.btopenworld.com [81.136.218.57]) by mx.google.com with ESMTPS id l23sm50762912wbb.8.2010.05.18.13.13.46 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 18 May 2010 13:13:47 -0700 (PDT) From: Liam Girdwood To: , Cc: Liam Girdwood , Mark Brown , Peter Ujfalusi , Jarkko Nikula , Tony Lindgren Subject: [PATCH 1/4] OMAP: mcbsp - add omap_mcbsp_set_dma_op_mode() Date: Tue, 18 May 2010 21:13:11 +0100 Message-Id: <1274213594-26554-2-git-send-email-lrg@slimlogic.co.uk> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1274213594-26554-1-git-send-email-lrg@slimlogic.co.uk> References: <1274213594-26554-1-git-send-email-lrg@slimlogic.co.uk> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 18 May 2010 20:13:51 +0000 (UTC) diff --git a/arch/arm/plat-omap/include/plat/mcbsp.h b/arch/arm/plat-omap/include/plat/mcbsp.h index 1bd7021..f8823f4 100644 --- a/arch/arm/plat-omap/include/plat/mcbsp.h +++ b/arch/arm/plat-omap/include/plat/mcbsp.h @@ -476,6 +476,7 @@ u16 omap_mcbsp_get_max_rx_threshold(unsigned int id); u16 omap_mcbsp_get_tx_delay(unsigned int id); u16 omap_mcbsp_get_rx_delay(unsigned int id); int omap_mcbsp_get_dma_op_mode(unsigned int id); +int omap_mcbsp_set_dma_op_mode(unsigned int id, unsigned int mode); #else static inline void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold) { } @@ -486,6 +487,7 @@ static inline u16 omap_mcbsp_get_max_rx_threshold(unsigned int id) { return 0; } static inline u16 omap_mcbsp_get_tx_delay(unsigned int id) { return 0; } static inline u16 omap_mcbsp_get_rx_delay(unsigned int id) { return 0; } static inline int omap_mcbsp_get_dma_op_mode(unsigned int id) { return 0; } +static inline int omap_mcbsp_set_dma_op_mode(unsigned int id, unsigned int mode) {return 0;} #endif int omap_mcbsp_request(unsigned int id); void omap_mcbsp_free(unsigned int id); diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c index 4820cab..cc2b73c 100644 --- a/arch/arm/plat-omap/mcbsp.c +++ b/arch/arm/plat-omap/mcbsp.c @@ -635,6 +635,37 @@ int omap_mcbsp_get_dma_op_mode(unsigned int id) } EXPORT_SYMBOL(omap_mcbsp_get_dma_op_mode); +/* + * omap_mcbsp_set_dma_op_mode set the current DMA + * operating mode for the mcbsp channel + */ +int omap_mcbsp_set_dma_op_mode(unsigned int id, unsigned int mode) +{ + struct omap_mcbsp *mcbsp; + int ret = 0; + + if (mode > MCBSP_DMA_MODE_FRAME) + return -EINVAL; + + if (!omap_mcbsp_check_valid_id(id)) { + printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); + return -ENODEV; + } + mcbsp = id_to_mcbsp_ptr(id); + + spin_lock_irq(&mcbsp->lock); + if (!mcbsp->free) { + ret = -EBUSY; + goto unlock; + } + mcbsp->dma_op_mode = mode; + +unlock: + spin_unlock_irq(&mcbsp->lock); + return ret; +} +EXPORT_SYMBOL(omap_mcbsp_set_dma_op_mode); + static inline void omap34xx_mcbsp_request(struct omap_mcbsp *mcbsp) { /*