Samuel Ortiz | e97e2dd | 2007-07-21 19:07:33 -0700 | [diff] [blame] | 1 | /* |
Alexander Shiyan | 96070ae | 2012-12-01 01:07:26 +0000 | [diff] [blame] | 2 | * IR port driver for the Cirrus Logic CLPS711X processors |
Samuel Ortiz | e97e2dd | 2007-07-21 19:07:33 -0700 | [diff] [blame] | 3 | * |
| 4 | * Copyright 2001, Blue Mug Inc. All rights reserved. |
| 5 | * Copyright 2007, Samuel Ortiz <samuel@sortiz.org> |
| 6 | */ |
Alexander Shiyan | 96070ae | 2012-12-01 01:07:26 +0000 | [diff] [blame] | 7 | |
Samuel Ortiz | e97e2dd | 2007-07-21 19:07:33 -0700 | [diff] [blame] | 8 | #include <linux/module.h> |
Alexander Shiyan | 96070ae | 2012-12-01 01:07:26 +0000 | [diff] [blame] | 9 | #include <linux/platform_device.h> |
Samuel Ortiz | e97e2dd | 2007-07-21 19:07:33 -0700 | [diff] [blame] | 10 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 11 | #include <mach/hardware.h> |
Samuel Ortiz | e97e2dd | 2007-07-21 19:07:33 -0700 | [diff] [blame] | 12 | |
| 13 | #include "sir-dev.h" |
| 14 | |
Alexander Shiyan | 96070ae | 2012-12-01 01:07:26 +0000 | [diff] [blame] | 15 | static int clps711x_dongle_open(struct sir_dev *dev) |
Samuel Ortiz | e97e2dd | 2007-07-21 19:07:33 -0700 | [diff] [blame] | 16 | { |
| 17 | unsigned int syscon; |
| 18 | |
| 19 | /* Turn on the SIR encoder. */ |
| 20 | syscon = clps_readl(SYSCON1); |
| 21 | syscon |= SYSCON1_SIREN; |
| 22 | clps_writel(syscon, SYSCON1); |
| 23 | |
| 24 | return 0; |
| 25 | } |
| 26 | |
Alexander Shiyan | 96070ae | 2012-12-01 01:07:26 +0000 | [diff] [blame] | 27 | static int clps711x_dongle_close(struct sir_dev *dev) |
Samuel Ortiz | e97e2dd | 2007-07-21 19:07:33 -0700 | [diff] [blame] | 28 | { |
| 29 | unsigned int syscon; |
| 30 | |
| 31 | /* Turn off the SIR encoder. */ |
| 32 | syscon = clps_readl(SYSCON1); |
| 33 | syscon &= ~SYSCON1_SIREN; |
| 34 | clps_writel(syscon, SYSCON1); |
| 35 | |
| 36 | return 0; |
| 37 | } |
| 38 | |
Alexander Shiyan | 96070ae | 2012-12-01 01:07:26 +0000 | [diff] [blame] | 39 | static struct dongle_driver clps711x_dongle = { |
| 40 | .owner = THIS_MODULE, |
| 41 | .driver_name = "EP7211 IR driver", |
| 42 | .type = IRDA_EP7211_DONGLE, |
| 43 | .open = clps711x_dongle_open, |
| 44 | .close = clps711x_dongle_close, |
| 45 | }; |
| 46 | |
| 47 | static int clps711x_sir_probe(struct platform_device *pdev) |
Samuel Ortiz | e97e2dd | 2007-07-21 19:07:33 -0700 | [diff] [blame] | 48 | { |
Alexander Shiyan | 96070ae | 2012-12-01 01:07:26 +0000 | [diff] [blame] | 49 | return irda_register_dongle(&clps711x_dongle); |
Samuel Ortiz | e97e2dd | 2007-07-21 19:07:33 -0700 | [diff] [blame] | 50 | } |
| 51 | |
Alexander Shiyan | 96070ae | 2012-12-01 01:07:26 +0000 | [diff] [blame] | 52 | static int clps711x_sir_remove(struct platform_device *pdev) |
Samuel Ortiz | e97e2dd | 2007-07-21 19:07:33 -0700 | [diff] [blame] | 53 | { |
Alexander Shiyan | 96070ae | 2012-12-01 01:07:26 +0000 | [diff] [blame] | 54 | return irda_unregister_dongle(&clps711x_dongle); |
Samuel Ortiz | e97e2dd | 2007-07-21 19:07:33 -0700 | [diff] [blame] | 55 | } |
| 56 | |
Alexander Shiyan | 96070ae | 2012-12-01 01:07:26 +0000 | [diff] [blame] | 57 | static struct platform_driver clps711x_sir_driver = { |
| 58 | .driver = { |
| 59 | .name = "sir-clps711x", |
| 60 | .owner = THIS_MODULE, |
| 61 | }, |
| 62 | .probe = clps711x_sir_probe, |
| 63 | .remove = clps711x_sir_remove, |
| 64 | }; |
| 65 | module_platform_driver(clps711x_sir_driver); |
| 66 | |
Samuel Ortiz | e97e2dd | 2007-07-21 19:07:33 -0700 | [diff] [blame] | 67 | MODULE_AUTHOR("Samuel Ortiz <samuel@sortiz.org>"); |
| 68 | MODULE_DESCRIPTION("EP7211 IR dongle driver"); |
| 69 | MODULE_LICENSE("GPL"); |
| 70 | MODULE_ALIAS("irda-dongle-13"); /* IRDA_EP7211_DONGLE */ |