// SPDX-License-Identifier: GPL-2.0
/*************************************************************************
* This code has been developed at the Institute of Sensor and Actuator *
* Systems (Technical University of Vienna, Austria) to enable the GPIO *
* lines (e.g. of a raspberry pi) to function as a GPIO master device *
* *
* authors : Thomas Klima *
* Marcello Carla' *
* Dave Penkler *
* *
* copyright : (C) 2016 Thomas Klima *
* *
*************************************************************************/
/*
* limitations:
* works only on RPi
* cannot function as non-CIC system controller with SN7516x because
* SN75161B cannot simultaneously make ATN input with IFC and REN as
* outputs.
* not implemented:
* parallel poll
* return2local
* device support (non master operation)
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#define dev_fmt pr_fmt
#define NAME KBUILD_MODNAME
#define ENABLE_IRQ(IRQ, TYPE) irq_set_irq_type(IRQ, TYPE)
#define DISABLE_IRQ(IRQ) irq_set_irq_type(IRQ, IRQ_TYPE_NONE)
/*
* Debug print levels:
* 0 = load/unload info and errors that make the driver fail;
* 1 = + warnings for unforeseen events that may break the current
* operation and lead to a timeout, but do not affect the
* driver integrity (mainly unexpected interrupts);
* 2 = + trace of function calls;
* 3 = + trace of protocol codes;
* 4 = + trace of interrupt operation.
*/
#define dbg_printk(level, frm, ...) \
do { if (debug >= (level)) \
dev_dbg(board->gpib_dev, frm, ## __VA_ARGS__); } \
while (0)
#define LINVAL gpiod_get_value(DAV), \
gpiod_get_value(NRFD), \
gpiod_get_value(NDAC), \
gpiod_get_value(SRQ)
#define LINFMT "DAV: %d NRFD:%d NDAC: %d SRQ: %d"
#include "gpibP.h"
#include "gpib_state_machines.h"
#include <linux/sched.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/gpio/driver.h>
#include <linux/gpio/machine.h>
#include <linux/gpio.h>
#include <linux/irq.h>
static int sn7516x_used = 1, sn7516x;
module_param(sn7516x_used, int, 0660);
#define PINMAP_0 "elektronomikon"