Root/
1 | /* |
2 | * Copyright (c) 2012 Bosch Sensortec GmbH |
3 | * Copyright (c) 2012 Unixphere AB |
4 | * |
5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. |
9 | * |
10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. |
14 | * |
15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
18 | */ |
19 | |
20 | #include <linux/module.h> |
21 | #include <linux/spi/spi.h> |
22 | #include <linux/err.h> |
23 | #include "bmp085.h" |
24 | |
25 | static int bmp085_spi_probe(struct spi_device *client) |
26 | { |
27 | int err; |
28 | struct regmap *regmap; |
29 | |
30 | client->bits_per_word = 8; |
31 | err = spi_setup(client); |
32 | if (err < 0) { |
33 | dev_err(&client->dev, "spi_setup failed!\n"); |
34 | return err; |
35 | } |
36 | |
37 | regmap = devm_regmap_init_spi(client, &bmp085_regmap_config); |
38 | if (IS_ERR(regmap)) { |
39 | err = PTR_ERR(regmap); |
40 | dev_err(&client->dev, "Failed to init regmap: %d\n", err); |
41 | return err; |
42 | } |
43 | |
44 | return bmp085_probe(&client->dev, regmap); |
45 | } |
46 | |
47 | static int bmp085_spi_remove(struct spi_device *client) |
48 | { |
49 | return bmp085_remove(&client->dev); |
50 | } |
51 | |
52 | static const struct of_device_id bmp085_of_match[] = { |
53 | { .compatible = "bosch,bmp085", }, |
54 | { }, |
55 | }; |
56 | MODULE_DEVICE_TABLE(of, bmp085_of_match); |
57 | |
58 | static const struct spi_device_id bmp085_id[] = { |
59 | { "bmp180", 0 }, |
60 | { "bmp181", 0 }, |
61 | { } |
62 | }; |
63 | MODULE_DEVICE_TABLE(spi, bmp085_id); |
64 | |
65 | static struct spi_driver bmp085_spi_driver = { |
66 | .driver = { |
67 | .owner = THIS_MODULE, |
68 | .name = BMP085_NAME, |
69 | .of_match_table = bmp085_of_match |
70 | }, |
71 | .id_table = bmp085_id, |
72 | .probe = bmp085_spi_probe, |
73 | .remove = bmp085_spi_remove |
74 | }; |
75 | |
76 | module_spi_driver(bmp085_spi_driver); |
77 | |
78 | MODULE_AUTHOR("Eric Andersson <eric.andersson@unixphere.com>"); |
79 | MODULE_DESCRIPTION("BMP085 SPI bus driver"); |
80 | MODULE_LICENSE("GPL"); |
81 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9