aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/irda/ep7211-sir.c
blob: 5fe1f4dd3369917d5531135d6f39784fc6dc5294 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
 * IR port driver for the Cirrus Logic CLPS711X processors
 *
 * Copyright 2001, Blue Mug Inc.  All rights reserved.
 * Copyright 2007, Samuel Ortiz <samuel@sortiz.org>
 */

#include <linux/module.h>
#include <linux/platform_device.h>

#include <mach/hardware.h>

#include "sir-dev.h"

static int clps711x_dongle_open(struct sir_dev *dev)
{
	unsigned int syscon;

	/* Turn on the SIR encoder. */
	syscon = clps_readl(SYSCON1);
	syscon |= SYSCON1_SIREN;
	clps_writel(syscon, SYSCON1);

	return 0;
}

static int clps711x_dongle_close(struct sir_dev *dev)
{
	unsigned int syscon;

	/* Turn off the SIR encoder. */
	syscon = clps_readl(SYSCON1);
	syscon &= ~SYSCON1_SIREN;
	clps_writel(syscon, SYSCON1);

	return 0;
}

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)
{
	return irda_register_dongle(&clps711x_dongle);
}

static int clps711x_sir_remove(struct platform_device *pdev)
{
	return irda_unregister_dongle(&clps711x_dongle);
}

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);

MODULE_AUTHOR("Samuel Ortiz <samuel@sortiz.org>");
MODULE_DESCRIPTION("EP7211 IR dongle driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("irda-dongle-13"); /* IRDA_EP7211_DONGLE */