2007-07-22 10:07:33 +08:00
|
|
|
/*
|
2012-12-01 09:07:26 +08:00
|
|
|
* IR port driver for the Cirrus Logic CLPS711X processors
|
2007-07-22 10:07:33 +08:00
|
|
|
*
|
|
|
|
* Copyright 2001, Blue Mug Inc. All rights reserved.
|
|
|
|
* Copyright 2007, Samuel Ortiz <samuel@sortiz.org>
|
|
|
|
*/
|
|
|
|
|
2012-12-01 09:07:26 +08:00
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/platform_device.h>
|
2007-07-22 10:07:33 +08:00
|
|
|
|
2008-08-05 23:14:15 +08:00
|
|
|
#include <mach/hardware.h>
|
2007-07-22 10:07:33 +08:00
|
|
|
|
|
|
|
#include "sir-dev.h"
|
|
|
|
|
2012-12-01 09:07:26 +08:00
|
|
|
static int clps711x_dongle_open(struct sir_dev *dev)
|
2007-07-22 10:07:33 +08:00
|
|
|
{
|
|
|
|
unsigned int syscon;
|
|
|
|
|
|
|
|
/* Turn on the SIR encoder. */
|
|
|
|
syscon = clps_readl(SYSCON1);
|
|
|
|
syscon |= SYSCON1_SIREN;
|
|
|
|
clps_writel(syscon, SYSCON1);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-12-01 09:07:26 +08:00
|
|
|
static int clps711x_dongle_close(struct sir_dev *dev)
|
2007-07-22 10:07:33 +08:00
|
|
|
{
|
|
|
|
unsigned int syscon;
|
|
|
|
|
|
|
|
/* Turn off the SIR encoder. */
|
|
|
|
syscon = clps_readl(SYSCON1);
|
|
|
|
syscon &= ~SYSCON1_SIREN;
|
|
|
|
clps_writel(syscon, SYSCON1);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-12-01 09:07:26 +08:00
|
|
|
static struct dongle_driver clps711x_dongle = {
|
|
|
|
.owner = THIS_MODULE,
|
|
|
|
.driver_name = "EP7211 IR driver",
|
|
|
|
.type = IRDA_EP7211_DONGLE,
|
|
|
|
.open = clps711x_dongle_open,
|
|
|
|
.close = clps711x_dongle_close,
|
|
|
|
};
|
|
|
|
|
|
|
|
static int clps711x_sir_probe(struct platform_device *pdev)
|
2007-07-22 10:07:33 +08:00
|
|
|
{
|
2012-12-01 09:07:26 +08:00
|
|
|
return irda_register_dongle(&clps711x_dongle);
|
2007-07-22 10:07:33 +08:00
|
|
|
}
|
|
|
|
|
2012-12-01 09:07:26 +08:00
|
|
|
static int clps711x_sir_remove(struct platform_device *pdev)
|
2007-07-22 10:07:33 +08:00
|
|
|
{
|
2012-12-01 09:07:26 +08:00
|
|
|
return irda_unregister_dongle(&clps711x_dongle);
|
2007-07-22 10:07:33 +08:00
|
|
|
}
|
|
|
|
|
2012-12-01 09:07:26 +08:00
|
|
|
static struct platform_driver clps711x_sir_driver = {
|
|
|
|
.driver = {
|
|
|
|
.name = "sir-clps711x",
|
|
|
|
.owner = THIS_MODULE,
|
|
|
|
},
|
|
|
|
.probe = clps711x_sir_probe,
|
|
|
|
.remove = clps711x_sir_remove,
|
|
|
|
};
|
|
|
|
module_platform_driver(clps711x_sir_driver);
|
|
|
|
|
2007-07-22 10:07:33 +08:00
|
|
|
MODULE_AUTHOR("Samuel Ortiz <samuel@sortiz.org>");
|
|
|
|
MODULE_DESCRIPTION("EP7211 IR dongle driver");
|
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
MODULE_ALIAS("irda-dongle-13"); /* IRDA_EP7211_DONGLE */
|