From: Andrew Morton <akpm@linux-foundation.org>
To: Michael Buesch <mb@bu3sch.de>
Cc: "linux-kernel" <linux-kernel@vger.kernel.org>
Subject: Re: Drivers for selfmade hardware
Date: Wed, 9 Jul 2008 22:45:57 -0700 [thread overview]
Message-ID: <20080709224557.45a85ff5.akpm@linux-foundation.org> (raw)
In-Reply-To: <200806292147.52112.mb@bu3sch.de>
On Sun, 29 Jun 2008 21:47:52 +0200 Michael Buesch <mb@bu3sch.de> wrote:
> I'm wondering what the policy is for selfmade hardware
> or other hardware where only a few pieces exist. Is it desired
> to get drivers for this kind of hardware merged upstream into the
> mainline kernel?
>
> I have a tiny driver that can be used to drive a modified
> Brooktree 8xx based card in 24-port GPIO mode.
> So the card can be used as a cheap digital PCI GPIO card.
> This hardware can be built with some soldering skills, a tiny
> soldering tip and a few hours of free time.
>
> So what's the policy? Push to mainline or keep as seperate
> patch?
>
> (The following patch is not complete, but just what I have for now
> to show you...)
>
> ...
>
> +#ifdef CONFIG_PM
> +static int btgpio_suspend(struct pci_dev *pdev, pm_message_t state)
> +{
> + struct btgpio *bg = pci_get_drvdata(pdev);
> + unsigned long flags;
> +
> + spin_lock_irqsave(&bg->lock, flags);
> +
> + bg->saved_outen = bgread(BT848_GPIO_OUT_EN);
> + bg->saved_data = bgread(BT848_GPIO_DATA);
> +
> + bgwrite(0, BT848_INT_MASK);
> + bgwrite(~0x0, BT848_INT_STAT);
> + bgwrite(0x0, BT848_GPIO_OUT_EN);
> +
> + spin_unlock_irqrestore(&bg->lock, flags);
> +
> + pci_save_state(pdev);
> + pci_disable_device(pdev);
> + pci_set_power_state(pdev, pci_choose_state(pdev, state));
> +
> + return 0;
> +}
> +
> +static int btgpio_resume(struct pci_dev *pdev)
> +{
> + struct btgpio *bg = pci_get_drvdata(pdev);
> + unsigned long flags;
> + int err;
> +
> + pci_set_power_state(pdev, 0);
> + err = pci_enable_device(pdev);
> + if (err)
> + return err;
> + pci_restore_state(pdev);
> +
> + spin_lock_irqsave(&bg->lock, flags);
> +
> + bgwrite(0, BT848_INT_MASK);
> + bgwrite(0, BT848_GPIO_REG_INP);
> + bgwrite(bg->saved_outen, BT848_GPIO_OUT_EN);
> + bgwrite(bg->saved_data, BT848_GPIO_DATA);
> +
> + spin_unlock_irqrestore(&bg->lock, flags);
> +
> + return 0;
> +}
#else
#define btgpio_suspend NULL
#define btgpio_resume NULL
> +#endif /* CONFIG_PM */
> +
> +static struct pci_device_id btgpio_pci_tbl[] = {
> + { PCI_DEVICE(PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT848) },
> + { PCI_DEVICE(PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT849) },
> + { PCI_DEVICE(PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT878) },
> + { PCI_DEVICE(PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT879) },
> + { 0, },
> +};
> +MODULE_DEVICE_TABLE(pci, btgpio_pci_tbl);
> +
> +static struct pci_driver btgpio_pci_driver = {
> + .name = "btgpio",
> + .id_table = btgpio_pci_tbl,
> + .probe = btgpio_probe,
> + .remove = btgpio_remove,
> +#ifdef CONFIG_PM
dd
> + .suspend = btgpio_suspend,
> + .resume = btgpio_resume,
> +#endif
dd
> +};
> +
next prev parent reply other threads:[~2008-07-10 5:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-29 19:47 Drivers for selfmade hardware Michael Buesch
2008-06-29 20:01 ` Christoph Hellwig
2008-06-29 21:26 ` Alan Cox
2008-06-30 9:50 ` Hans J. Koch
2008-06-30 10:00 ` Michael Buesch
2008-06-30 15:37 ` Miguel Ojeda
2008-07-10 5:45 ` Andrew Morton [this message]
2008-07-10 12:57 ` Michael Buesch
2008-07-10 13:13 ` Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080709224557.45a85ff5.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mb@bu3sch.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox