linux/sound/drivers/mts64.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*     
 *   ALSA Driver for Ego Systems Inc. (ESI) Miditerminal 4140
 *   Copyright (c) 2006 by Matthias König <[email protected]>
 */

#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/parport.h>
#include <linux/spinlock.h>
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <sound/core.h>
#include <sound/initval.h>
#include <sound/rawmidi.h>
#include <sound/control.h>

#define CARD_NAME
#define DRIVER_NAME
#define PLATFORM_DRIVER

static int index[SNDRV_CARDS]  =;
static char *id[SNDRV_CARDS]   =;
static bool enable[SNDRV_CARDS] =;

static struct platform_device *platform_devices[SNDRV_CARDS]; 
static int device_count;

module_param_array();
MODULE_PARM_DESC();
module_param_array();
MODULE_PARM_DESC();
module_param_array();
MODULE_PARM_DESC();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();

/*********************************************************************
 * Chip specific
 *********************************************************************/
#define MTS64_NUM_INPUT_PORTS
#define MTS64_NUM_OUTPUT_PORTS
#define MTS64_SMPTE_SUBSTREAM

struct mts64 {};

static int snd_mts64_free(struct mts64 *mts)
{}

static int snd_mts64_create(struct snd_card *card,
			    struct pardevice *pardev,
			    struct mts64 **rchip)
{}

/*********************************************************************
 * HW register related constants
 *********************************************************************/

/* Status Bits */
#define MTS64_STAT_BSY
#define MTS64_STAT_BIT_SET
#define MTS64_STAT_PORT

/* Control Bits */
#define MTS64_CTL_READOUT
#define MTS64_CTL_WRITE_CMD  
#define MTS64_CTL_WRITE_DATA  
#define MTS64_CTL_STROBE  

/* Command */
#define MTS64_CMD_RESET
#define MTS64_CMD_PROBE
#define MTS64_CMD_SMPTE_SET_TIME
#define MTS64_CMD_SMPTE_SET_FPS
#define MTS64_CMD_SMPTE_STOP
#define MTS64_CMD_SMPTE_FPS_24
#define MTS64_CMD_SMPTE_FPS_25
#define MTS64_CMD_SMPTE_FPS_2997 
#define MTS64_CMD_SMPTE_FPS_30D
#define MTS64_CMD_SMPTE_FPS_30
#define MTS64_CMD_COM_OPEN
#define MTS64_CMD_COM_CLOSE1
#define MTS64_CMD_COM_CLOSE2

/*********************************************************************
 * Hardware specific functions
 *********************************************************************/
static void mts64_enable_readout(struct parport *p);
static void mts64_disable_readout(struct parport *p);
static int mts64_device_ready(struct parport *p);
static int mts64_device_init(struct parport *p);
static int mts64_device_open(struct mts64 *mts);
static int mts64_device_close(struct mts64 *mts);
static u8 mts64_map_midi_input(u8 c);
static int mts64_probe(struct parport *p);
static u16 mts64_read(struct parport *p);
static u8 mts64_read_char(struct parport *p);
static void mts64_smpte_start(struct parport *p,
			      u8 hours, u8 minutes,
			      u8 seconds, u8 frames,
			      u8 idx);
static void mts64_smpte_stop(struct parport *p);
static void mts64_write_command(struct parport *p, u8 c);
static void mts64_write_data(struct parport *p, u8 c);
static void mts64_write_midi(struct mts64 *mts, u8 c, int midiport);


/*  Enables the readout procedure
 *
 *  Before we can read a midi byte from the device, we have to set
 *  bit 3 of control port.
 */
static void mts64_enable_readout(struct parport *p)
{}

/*  Disables readout 
 *
 *  Readout is disabled by clearing bit 3 of control
 */
static void mts64_disable_readout(struct parport *p)
{}

/*  waits for device ready
 *
 *  Checks if BUSY (Bit 7 of status) is clear
 *  1 device ready
 *  0 failure
 */
static int mts64_device_ready(struct parport *p)
{}

/*  Init device (LED blinking startup magic)
 *
 *  Returns:
 *  0 init ok
 *  -EIO failure
 */
static int mts64_device_init(struct parport *p)
{}

/* 
 *  Opens the device (set communication mode)
 */
static int mts64_device_open(struct mts64 *mts)
{}

/*  
 *  Close device (clear communication mode)
 */
static int mts64_device_close(struct mts64 *mts)
{}

/*  map hardware port to substream number
 * 
 *  When reading a byte from the device, the device tells us
 *  on what port the byte is. This HW port has to be mapped to
 *  the midiport (substream number).
 *  substream 0-3 are Midiports 1-4
 *  substream 4 is SMPTE Timecode
 *  The mapping is done by the table:
 *  HW | 0 | 1 | 2 | 3 | 4 
 *  SW | 0 | 1 | 4 | 2 | 3
 */
static u8 mts64_map_midi_input(u8 c)
{}


/*  Probe parport for device
 *
 *  Do we have a Miditerminal 4140 on parport? 
 *  Returns:
 *  0       device found
 *  -ENODEV no device
 */
static int mts64_probe(struct parport *p)
{}

/*  Read byte incl. status from device
 *
 *  Returns:
 *  data in lower 8 bits and status in upper 8 bits
 */
static u16 mts64_read(struct parport *p)
{}

/*  Read a byte from device
 *
 *  Note, that readout mode has to be enabled.
 *  readout procedure is as follows: 
 *  - Write number of the Bit to read to DATA
 *  - Read STATUS
 *  - Bit 5 of STATUS indicates if Bit is set
 *
 *  Returns:
 *  Byte read from device
 */
static u8 mts64_read_char(struct parport *p)
{}

/*  Starts SMPTE Timecode generation
 *
 *  The device creates SMPTE Timecode by hardware.
 *  0 24 fps
 *  1 25 fps
 *  2 29.97 fps
 *  3 30 fps (Drop-frame)
 *  4 30 fps
 */
static void mts64_smpte_start(struct parport *p,
			      u8 hours, u8 minutes,
			      u8 seconds, u8 frames,
			      u8 idx)
{}

/*  Stops SMPTE Timecode generation
 */
static void mts64_smpte_stop(struct parport *p)
{}

/*  Write a command byte to device
 */
static void mts64_write_command(struct parport *p, u8 c)
{}

/*  Write a data byte to device 
 */
static void mts64_write_data(struct parport *p, u8 c)
{}

/*  Write a MIDI byte to midiport
 *
 *  midiport ranges from 0-3 and maps to Ports 1-4
 *  assumptions: communication mode is on
 */
static void mts64_write_midi(struct mts64 *mts, u8 c,
			     int midiport)
{}

/*********************************************************************
 * Control elements
 *********************************************************************/

/* SMPTE Switch */
#define snd_mts64_ctl_smpte_switch_info

static int snd_mts64_ctl_smpte_switch_get(struct snd_kcontrol* kctl,
					  struct snd_ctl_elem_value *uctl)
{}

/* smpte_switch is not accessed from IRQ handler, so we just need
   to protect the HW access */
static int snd_mts64_ctl_smpte_switch_put(struct snd_kcontrol* kctl,
					  struct snd_ctl_elem_value *uctl)
{}

static const struct snd_kcontrol_new mts64_ctl_smpte_switch =;

/* Time */
static int snd_mts64_ctl_smpte_time_h_info(struct snd_kcontrol *kctl,
					   struct snd_ctl_elem_info *uinfo)
{}

static int snd_mts64_ctl_smpte_time_f_info(struct snd_kcontrol *kctl,
					   struct snd_ctl_elem_info *uinfo)
{}

static int snd_mts64_ctl_smpte_time_info(struct snd_kcontrol *kctl,
					 struct snd_ctl_elem_info *uinfo)
{}

static int snd_mts64_ctl_smpte_time_get(struct snd_kcontrol *kctl,
					struct snd_ctl_elem_value *uctl)
{}

static int snd_mts64_ctl_smpte_time_put(struct snd_kcontrol *kctl,
					struct snd_ctl_elem_value *uctl)
{}

static const struct snd_kcontrol_new mts64_ctl_smpte_time_hours =;

static const struct snd_kcontrol_new mts64_ctl_smpte_time_minutes =;

static const struct snd_kcontrol_new mts64_ctl_smpte_time_seconds =;

static const struct snd_kcontrol_new mts64_ctl_smpte_time_frames =;

/* FPS */
static int snd_mts64_ctl_smpte_fps_info(struct snd_kcontrol *kctl,
					struct snd_ctl_elem_info *uinfo)
{}

static int snd_mts64_ctl_smpte_fps_get(struct snd_kcontrol *kctl,
				       struct snd_ctl_elem_value *uctl)
{}

static int snd_mts64_ctl_smpte_fps_put(struct snd_kcontrol *kctl,
				       struct snd_ctl_elem_value *uctl)
{}

static const struct snd_kcontrol_new mts64_ctl_smpte_fps =;


static int snd_mts64_ctl_create(struct snd_card *card,
				struct mts64 *mts)
{}

/*********************************************************************
 * Rawmidi
 *********************************************************************/
#define MTS64_MODE_INPUT_TRIGGERED

static int snd_mts64_rawmidi_open(struct snd_rawmidi_substream *substream)
{}

static int snd_mts64_rawmidi_close(struct snd_rawmidi_substream *substream)
{}

static void snd_mts64_rawmidi_output_trigger(struct snd_rawmidi_substream *substream,
					     int up)
{}

static void snd_mts64_rawmidi_input_trigger(struct snd_rawmidi_substream *substream,
					    int up)
{}

static const struct snd_rawmidi_ops snd_mts64_rawmidi_output_ops =;

static const struct snd_rawmidi_ops snd_mts64_rawmidi_input_ops =;

/* Create and initialize the rawmidi component */
static int snd_mts64_rawmidi_create(struct snd_card *card)
{}

/*********************************************************************
 * parport stuff
 *********************************************************************/
static void snd_mts64_interrupt(void *private)
{}

static void snd_mts64_attach(struct parport *p)
{}

static void snd_mts64_detach(struct parport *p)
{}

static int snd_mts64_dev_probe(struct pardevice *pardev)
{}

static struct parport_driver mts64_parport_driver =;

/*********************************************************************
 * platform stuff
 *********************************************************************/
static void snd_mts64_card_private_free(struct snd_card *card)
{}

static int snd_mts64_probe(struct platform_device *pdev)
{}

static void snd_mts64_remove(struct platform_device *pdev)
{}

static struct platform_driver snd_mts64_driver =;

/*********************************************************************
 * module init stuff
 *********************************************************************/
static void snd_mts64_unregister_all(void)
{}

static int __init snd_mts64_module_init(void)
{}

static void __exit snd_mts64_module_exit(void)
{}

module_init();
module_exit(snd_mts64_module_exit);