Path: blob/master/drivers/media/video/bt8xx/bttv-if.c
10785 views
/*12bttv-if.c -- old gpio interface to other kernel modules3don't use in new code, will go away in 2.74have a look at bttv-gpio.c instead.56bttv - Bt848 frame grabber driver78Copyright (C) 1996,97,98 Ralph Metzler ([email protected])9& Marcus Metzler ([email protected])10(c) 1999-2003 Gerd Knorr <[email protected]>1112This program is free software; you can redistribute it and/or modify13it under the terms of the GNU General Public License as published by14the Free Software Foundation; either version 2 of the License, or15(at your option) any later version.1617This program is distributed in the hope that it will be useful,18but WITHOUT ANY WARRANTY; without even the implied warranty of19MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the20GNU General Public License for more details.2122You should have received a copy of the GNU General Public License23along with this program; if not, write to the Free Software24Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.2526*/2728#include <linux/module.h>29#include <linux/init.h>30#include <linux/delay.h>31#include <asm/io.h>3233#include "bttvp.h"3435EXPORT_SYMBOL(bttv_get_pcidev);36EXPORT_SYMBOL(bttv_gpio_enable);37EXPORT_SYMBOL(bttv_read_gpio);38EXPORT_SYMBOL(bttv_write_gpio);3940/* ----------------------------------------------------------------------- */41/* Exported functions - for other modules which want to access the */42/* gpio ports (IR for example) */43/* see bttv.h for comments */4445struct pci_dev* bttv_get_pcidev(unsigned int card)46{47if (card >= bttv_num)48return NULL;49if (!bttvs[card])50return NULL;5152return bttvs[card]->c.pci;53}545556int bttv_gpio_enable(unsigned int card, unsigned long mask, unsigned long data)57{58struct bttv *btv;5960if (card >= bttv_num) {61return -EINVAL;62}6364btv = bttvs[card];65if (!btv)66return -ENODEV;6768gpio_inout(mask,data);69if (bttv_gpio)70bttv_gpio_tracking(btv,"extern enable");71return 0;72}7374int bttv_read_gpio(unsigned int card, unsigned long *data)75{76struct bttv *btv;7778if (card >= bttv_num) {79return -EINVAL;80}8182btv = bttvs[card];83if (!btv)84return -ENODEV;8586if(btv->shutdown) {87return -ENODEV;88}8990/* prior setting BT848_GPIO_REG_INP is (probably) not needed91because we set direct input on init */92*data = gpio_read();93return 0;94}9596int bttv_write_gpio(unsigned int card, unsigned long mask, unsigned long data)97{98struct bttv *btv;99100if (card >= bttv_num) {101return -EINVAL;102}103104btv = bttvs[card];105if (!btv)106return -ENODEV;107108/* prior setting BT848_GPIO_REG_INP is (probably) not needed109because direct input is set on init */110gpio_bits(mask,data);111if (bttv_gpio)112bttv_gpio_tracking(btv,"extern write");113return 0;114}115116/*117* Local variables:118* c-basic-offset: 8119* End:120*/121122123