linux/sound/soc/blackfin/bf6xx-sport.h
<<
>>
Prefs
   1/*
   2 * bf6xx_sport - Analog Devices BF6XX SPORT driver
   3 *
   4 * Copyright (c) 2012 Analog Devices Inc.
   5 *
   6 * This program is free software; you can redistribute it and/or modify
   7 * it under the terms of the GNU General Public License version 2 as
   8 * published by the Free Software Foundation.
   9 *
  10 * This program is distributed in the hope that it will be useful,
  11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13 * GNU General Public License for more details.
  14 *
  15 * You should have received a copy of the GNU General Public License
  16 * along with this program; if not, write to the Free Software
  17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18 */
  19
  20#ifndef _BF6XX_SPORT_H_
  21#define _BF6XX_SPORT_H_
  22
  23#include <linux/platform_device.h>
  24#include <asm/bfin_sport3.h>
  25
  26struct sport_device {
  27        struct platform_device *pdev;
  28        const unsigned short *pin_req;
  29        struct sport_register *tx_regs;
  30        struct sport_register *rx_regs;
  31        int tx_dma_chan;
  32        int rx_dma_chan;
  33        int tx_err_irq;
  34        int rx_err_irq;
  35
  36        void (*tx_callback)(void *data);
  37        void *tx_data;
  38        void (*rx_callback)(void *data);
  39        void *rx_data;
  40
  41        struct dmasg *tx_desc;
  42        struct dmasg *rx_desc;
  43        unsigned int tx_desc_size;
  44        unsigned int rx_desc_size;
  45        unsigned char *tx_buf;
  46        unsigned char *rx_buf;
  47        unsigned int tx_fragsize;
  48        unsigned int rx_fragsize;
  49        unsigned int tx_frags;
  50        unsigned int rx_frags;
  51        unsigned int wdsize;
  52};
  53
  54struct sport_params {
  55        u32 spctl;
  56        u32 div;
  57};
  58
  59struct sport_device *sport_create(struct platform_device *pdev);
  60void sport_delete(struct sport_device *sport);
  61int sport_set_tx_params(struct sport_device *sport,
  62                struct sport_params *params);
  63int sport_set_rx_params(struct sport_device *sport,
  64                struct sport_params *params);
  65void sport_tx_start(struct sport_device *sport);
  66void sport_rx_start(struct sport_device *sport);
  67void sport_tx_stop(struct sport_device *sport);
  68void sport_rx_stop(struct sport_device *sport);
  69void sport_set_tx_callback(struct sport_device *sport,
  70        void (*tx_callback)(void *), void *tx_data);
  71void sport_set_rx_callback(struct sport_device *sport,
  72        void (*rx_callback)(void *), void *rx_data);
  73int sport_config_tx_dma(struct sport_device *sport, void *buf,
  74        int fragcount, size_t fragsize);
  75int sport_config_rx_dma(struct sport_device *sport, void *buf,
  76        int fragcount, size_t fragsize);
  77unsigned long sport_curr_offset_tx(struct sport_device *sport);
  78unsigned long sport_curr_offset_rx(struct sport_device *sport);
  79
  80
  81
  82#endif
  83