WIP FPC-III support
[linux/fpc-iii.git] / drivers / iio / magnetometer / hmc5843_core.c
blob780faea61d82ed7c0d78f906987e4f6bdac17fa3
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Device driver for the the HMC5843 multi-chip module designed
4 * for low field magnetic sensing.
6 * Copyright (C) 2010 Texas Instruments
8 * Author: Shubhrajyoti Datta <shubhrajyoti@ti.com>
9 * Acknowledgment: Jonathan Cameron <jic23@kernel.org> for valuable inputs.
10 * Support for HMC5883 and HMC5883L by Peter Meerwald <pmeerw@pmeerw.net>.
11 * Split to multiple files by Josef Gajdusek <atx@atx.name> - 2014
14 #include <linux/module.h>
15 #include <linux/regmap.h>
16 #include <linux/iio/iio.h>
17 #include <linux/iio/sysfs.h>
18 #include <linux/iio/trigger_consumer.h>
19 #include <linux/iio/buffer.h>
20 #include <linux/iio/triggered_buffer.h>
21 #include <linux/delay.h>
23 #include "hmc5843.h"
26 * Range gain settings in (+-)Ga
27 * Beware: HMC5843 and HMC5883 have different recommended sensor field
28 * ranges; default corresponds to +-1.0 Ga and +-1.3 Ga, respectively
30 #define HMC5843_RANGE_GAIN_OFFSET 0x05
31 #define HMC5843_RANGE_GAIN_DEFAULT 0x01
32 #define HMC5843_RANGE_GAIN_MASK 0xe0
34 /* Device status */
35 #define HMC5843_DATA_READY 0x01
36 #define HMC5843_DATA_OUTPUT_LOCK 0x02
38 /* Mode register configuration */
39 #define HMC5843_MODE_CONVERSION_CONTINUOUS 0x00
40 #define HMC5843_MODE_CONVERSION_SINGLE 0x01
41 #define HMC5843_MODE_IDLE 0x02
42 #define HMC5843_MODE_SLEEP 0x03
43 #define HMC5843_MODE_MASK 0x03
46 * HMC5843: Minimum data output rate
47 * HMC5883: Typical data output rate
49 #define HMC5843_RATE_OFFSET 0x02
50 #define HMC5843_RATE_DEFAULT 0x04
51 #define HMC5843_RATE_MASK 0x1c
53 /* Device measurement configuration */
54 #define HMC5843_MEAS_CONF_NORMAL 0x00
55 #define HMC5843_MEAS_CONF_POSITIVE_BIAS 0x01
56 #define HMC5843_MEAS_CONF_NEGATIVE_BIAS 0x02
57 #define HMC5843_MEAS_CONF_MASK 0x03
60 * API for setting the measurement configuration to
61 * Normal, Positive bias and Negative bias
63 * From the datasheet:
64 * 0 - Normal measurement configuration (default): In normal measurement
65 * configuration the device follows normal measurement flow. Pins BP
66 * and BN are left floating and high impedance.
68 * 1 - Positive bias configuration: In positive bias configuration, a
69 * positive current is forced across the resistive load on pins BP
70 * and BN.
72 * 2 - Negative bias configuration. In negative bias configuration, a
73 * negative current is forced across the resistive load on pins BP
74 * and BN.
76 * 3 - Only available on HMC5983. Magnetic sensor is disabled.
77 * Temperature sensor is enabled.
80 static const char *const hmc5843_meas_conf_modes[] = {"normal", "positivebias",
81 "negativebias"};
83 static const char *const hmc5983_meas_conf_modes[] = {"normal", "positivebias",
84 "negativebias",
85 "disabled"};
86 /* Scaling factors: 10000000/Gain */
87 static const int hmc5843_regval_to_nanoscale[] = {
88 6173, 7692, 10309, 12821, 18868, 21739, 25641, 35714
91 static const int hmc5883_regval_to_nanoscale[] = {
92 7812, 9766, 13021, 16287, 24096, 27701, 32573, 45662
95 static const int hmc5883l_regval_to_nanoscale[] = {
96 7299, 9174, 12195, 15152, 22727, 25641, 30303, 43478
100 * From the datasheet:
101 * Value | HMC5843 | HMC5883/HMC5883L
102 * | Data output rate (Hz) | Data output rate (Hz)
103 * 0 | 0.5 | 0.75
104 * 1 | 1 | 1.5
105 * 2 | 2 | 3
106 * 3 | 5 | 7.5
107 * 4 | 10 (default) | 15
108 * 5 | 20 | 30
109 * 6 | 50 | 75
110 * 7 | Not used | Not used
112 static const int hmc5843_regval_to_samp_freq[][2] = {
113 {0, 500000}, {1, 0}, {2, 0}, {5, 0}, {10, 0}, {20, 0}, {50, 0}
116 static const int hmc5883_regval_to_samp_freq[][2] = {
117 {0, 750000}, {1, 500000}, {3, 0}, {7, 500000}, {15, 0}, {30, 0},
118 {75, 0}
121 static const int hmc5983_regval_to_samp_freq[][2] = {
122 {0, 750000}, {1, 500000}, {3, 0}, {7, 500000}, {15, 0}, {30, 0},
123 {75, 0}, {220, 0}
126 /* Describe chip variants */
127 struct hmc5843_chip_info {
128 const struct iio_chan_spec *channels;
129 const int (*regval_to_samp_freq)[2];
130 const int n_regval_to_samp_freq;
131 const int *regval_to_nanoscale;
132 const int n_regval_to_nanoscale;
135 /* The lower two bits contain the current conversion mode */
136 static s32 hmc5843_set_mode(struct hmc5843_data *data, u8 operating_mode)
138 int ret;
140 mutex_lock(&data->lock);
141 ret = regmap_update_bits(data->regmap, HMC5843_MODE_REG,
142 HMC5843_MODE_MASK, operating_mode);
143 mutex_unlock(&data->lock);
145 return ret;
148 static int hmc5843_wait_measurement(struct hmc5843_data *data)
150 int tries = 150;
151 unsigned int val;
152 int ret;
154 while (tries-- > 0) {
155 ret = regmap_read(data->regmap, HMC5843_STATUS_REG, &val);
156 if (ret < 0)
157 return ret;
158 if (val & HMC5843_DATA_READY)
159 break;
160 msleep(20);
163 if (tries < 0) {
164 dev_err(data->dev, "data not ready\n");
165 return -EIO;
168 return 0;
171 /* Return the measurement value from the specified channel */
172 static int hmc5843_read_measurement(struct hmc5843_data *data,
173 int idx, int *val)
175 __be16 values[3];
176 int ret;
178 mutex_lock(&data->lock);
179 ret = hmc5843_wait_measurement(data);
180 if (ret < 0) {
181 mutex_unlock(&data->lock);
182 return ret;
184 ret = regmap_bulk_read(data->regmap, HMC5843_DATA_OUT_MSB_REGS,
185 values, sizeof(values));
186 mutex_unlock(&data->lock);
187 if (ret < 0)
188 return ret;
190 *val = sign_extend32(be16_to_cpu(values[idx]), 15);
191 return IIO_VAL_INT;
194 static int hmc5843_set_meas_conf(struct hmc5843_data *data, u8 meas_conf)
196 int ret;
198 mutex_lock(&data->lock);
199 ret = regmap_update_bits(data->regmap, HMC5843_CONFIG_REG_A,
200 HMC5843_MEAS_CONF_MASK, meas_conf);
201 mutex_unlock(&data->lock);
203 return ret;
206 static
207 int hmc5843_show_measurement_configuration(struct iio_dev *indio_dev,
208 const struct iio_chan_spec *chan)
210 struct hmc5843_data *data = iio_priv(indio_dev);
211 unsigned int val;
212 int ret;
214 ret = regmap_read(data->regmap, HMC5843_CONFIG_REG_A, &val);
215 if (ret)
216 return ret;
218 return val & HMC5843_MEAS_CONF_MASK;
221 static
222 int hmc5843_set_measurement_configuration(struct iio_dev *indio_dev,
223 const struct iio_chan_spec *chan,
224 unsigned int meas_conf)
226 struct hmc5843_data *data = iio_priv(indio_dev);
228 return hmc5843_set_meas_conf(data, meas_conf);
231 static const struct iio_mount_matrix *
232 hmc5843_get_mount_matrix(const struct iio_dev *indio_dev,
233 const struct iio_chan_spec *chan)
235 struct hmc5843_data *data = iio_priv(indio_dev);
237 return &data->orientation;
240 static const struct iio_enum hmc5843_meas_conf_enum = {
241 .items = hmc5843_meas_conf_modes,
242 .num_items = ARRAY_SIZE(hmc5843_meas_conf_modes),
243 .get = hmc5843_show_measurement_configuration,
244 .set = hmc5843_set_measurement_configuration,
247 static const struct iio_chan_spec_ext_info hmc5843_ext_info[] = {
248 IIO_ENUM("meas_conf", IIO_SHARED_BY_TYPE, &hmc5843_meas_conf_enum),
249 IIO_ENUM_AVAILABLE("meas_conf", &hmc5843_meas_conf_enum),
250 IIO_MOUNT_MATRIX(IIO_SHARED_BY_DIR, hmc5843_get_mount_matrix),
254 static const struct iio_enum hmc5983_meas_conf_enum = {
255 .items = hmc5983_meas_conf_modes,
256 .num_items = ARRAY_SIZE(hmc5983_meas_conf_modes),
257 .get = hmc5843_show_measurement_configuration,
258 .set = hmc5843_set_measurement_configuration,
261 static const struct iio_chan_spec_ext_info hmc5983_ext_info[] = {
262 IIO_ENUM("meas_conf", IIO_SHARED_BY_TYPE, &hmc5983_meas_conf_enum),
263 IIO_ENUM_AVAILABLE("meas_conf", &hmc5983_meas_conf_enum),
264 IIO_MOUNT_MATRIX(IIO_SHARED_BY_DIR, hmc5843_get_mount_matrix),
268 static
269 ssize_t hmc5843_show_samp_freq_avail(struct device *dev,
270 struct device_attribute *attr, char *buf)
272 struct hmc5843_data *data = iio_priv(dev_to_iio_dev(dev));
273 size_t len = 0;
274 int i;
276 for (i = 0; i < data->variant->n_regval_to_samp_freq; i++)
277 len += scnprintf(buf + len, PAGE_SIZE - len,
278 "%d.%d ", data->variant->regval_to_samp_freq[i][0],
279 data->variant->regval_to_samp_freq[i][1]);
281 /* replace trailing space by newline */
282 buf[len - 1] = '\n';
284 return len;
287 static IIO_DEV_ATTR_SAMP_FREQ_AVAIL(hmc5843_show_samp_freq_avail);
289 static int hmc5843_set_samp_freq(struct hmc5843_data *data, u8 rate)
291 int ret;
293 mutex_lock(&data->lock);
294 ret = regmap_update_bits(data->regmap, HMC5843_CONFIG_REG_A,
295 HMC5843_RATE_MASK,
296 rate << HMC5843_RATE_OFFSET);
297 mutex_unlock(&data->lock);
299 return ret;
302 static int hmc5843_get_samp_freq_index(struct hmc5843_data *data,
303 int val, int val2)
305 int i;
307 for (i = 0; i < data->variant->n_regval_to_samp_freq; i++)
308 if (val == data->variant->regval_to_samp_freq[i][0] &&
309 val2 == data->variant->regval_to_samp_freq[i][1])
310 return i;
312 return -EINVAL;
315 static int hmc5843_set_range_gain(struct hmc5843_data *data, u8 range)
317 int ret;
319 mutex_lock(&data->lock);
320 ret = regmap_update_bits(data->regmap, HMC5843_CONFIG_REG_B,
321 HMC5843_RANGE_GAIN_MASK,
322 range << HMC5843_RANGE_GAIN_OFFSET);
323 mutex_unlock(&data->lock);
325 return ret;
328 static ssize_t hmc5843_show_scale_avail(struct device *dev,
329 struct device_attribute *attr,
330 char *buf)
332 struct hmc5843_data *data = iio_priv(dev_to_iio_dev(dev));
334 size_t len = 0;
335 int i;
337 for (i = 0; i < data->variant->n_regval_to_nanoscale; i++)
338 len += scnprintf(buf + len, PAGE_SIZE - len,
339 "0.%09d ", data->variant->regval_to_nanoscale[i]);
341 /* replace trailing space by newline */
342 buf[len - 1] = '\n';
344 return len;
347 static IIO_DEVICE_ATTR(scale_available, S_IRUGO,
348 hmc5843_show_scale_avail, NULL, 0);
350 static int hmc5843_get_scale_index(struct hmc5843_data *data, int val, int val2)
352 int i;
354 if (val)
355 return -EINVAL;
357 for (i = 0; i < data->variant->n_regval_to_nanoscale; i++)
358 if (val2 == data->variant->regval_to_nanoscale[i])
359 return i;
361 return -EINVAL;
364 static int hmc5843_read_raw(struct iio_dev *indio_dev,
365 struct iio_chan_spec const *chan,
366 int *val, int *val2, long mask)
368 struct hmc5843_data *data = iio_priv(indio_dev);
369 unsigned int rval;
370 int ret;
372 switch (mask) {
373 case IIO_CHAN_INFO_RAW:
374 return hmc5843_read_measurement(data, chan->scan_index, val);
375 case IIO_CHAN_INFO_SCALE:
376 ret = regmap_read(data->regmap, HMC5843_CONFIG_REG_B, &rval);
377 if (ret < 0)
378 return ret;
379 rval >>= HMC5843_RANGE_GAIN_OFFSET;
380 *val = 0;
381 *val2 = data->variant->regval_to_nanoscale[rval];
382 return IIO_VAL_INT_PLUS_NANO;
383 case IIO_CHAN_INFO_SAMP_FREQ:
384 ret = regmap_read(data->regmap, HMC5843_CONFIG_REG_A, &rval);
385 if (ret < 0)
386 return ret;
387 rval >>= HMC5843_RATE_OFFSET;
388 *val = data->variant->regval_to_samp_freq[rval][0];
389 *val2 = data->variant->regval_to_samp_freq[rval][1];
390 return IIO_VAL_INT_PLUS_MICRO;
392 return -EINVAL;
395 static int hmc5843_write_raw(struct iio_dev *indio_dev,
396 struct iio_chan_spec const *chan,
397 int val, int val2, long mask)
399 struct hmc5843_data *data = iio_priv(indio_dev);
400 int rate, range;
402 switch (mask) {
403 case IIO_CHAN_INFO_SAMP_FREQ:
404 rate = hmc5843_get_samp_freq_index(data, val, val2);
405 if (rate < 0)
406 return -EINVAL;
408 return hmc5843_set_samp_freq(data, rate);
409 case IIO_CHAN_INFO_SCALE:
410 range = hmc5843_get_scale_index(data, val, val2);
411 if (range < 0)
412 return -EINVAL;
414 return hmc5843_set_range_gain(data, range);
415 default:
416 return -EINVAL;
420 static int hmc5843_write_raw_get_fmt(struct iio_dev *indio_dev,
421 struct iio_chan_spec const *chan,
422 long mask)
424 switch (mask) {
425 case IIO_CHAN_INFO_SAMP_FREQ:
426 return IIO_VAL_INT_PLUS_MICRO;
427 case IIO_CHAN_INFO_SCALE:
428 return IIO_VAL_INT_PLUS_NANO;
429 default:
430 return -EINVAL;
434 static irqreturn_t hmc5843_trigger_handler(int irq, void *p)
436 struct iio_poll_func *pf = p;
437 struct iio_dev *indio_dev = pf->indio_dev;
438 struct hmc5843_data *data = iio_priv(indio_dev);
439 int ret;
441 mutex_lock(&data->lock);
442 ret = hmc5843_wait_measurement(data);
443 if (ret < 0) {
444 mutex_unlock(&data->lock);
445 goto done;
448 ret = regmap_bulk_read(data->regmap, HMC5843_DATA_OUT_MSB_REGS,
449 data->buffer, 3 * sizeof(__be16));
451 mutex_unlock(&data->lock);
452 if (ret < 0)
453 goto done;
455 iio_push_to_buffers_with_timestamp(indio_dev, data->buffer,
456 iio_get_time_ns(indio_dev));
458 done:
459 iio_trigger_notify_done(indio_dev->trig);
461 return IRQ_HANDLED;
464 #define HMC5843_CHANNEL(axis, idx) \
466 .type = IIO_MAGN, \
467 .modified = 1, \
468 .channel2 = IIO_MOD_##axis, \
469 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
470 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) | \
471 BIT(IIO_CHAN_INFO_SAMP_FREQ), \
472 .scan_index = idx, \
473 .scan_type = { \
474 .sign = 's', \
475 .realbits = 16, \
476 .storagebits = 16, \
477 .endianness = IIO_BE, \
478 }, \
479 .ext_info = hmc5843_ext_info, \
482 #define HMC5983_CHANNEL(axis, idx) \
484 .type = IIO_MAGN, \
485 .modified = 1, \
486 .channel2 = IIO_MOD_##axis, \
487 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
488 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) | \
489 BIT(IIO_CHAN_INFO_SAMP_FREQ), \
490 .scan_index = idx, \
491 .scan_type = { \
492 .sign = 's', \
493 .realbits = 16, \
494 .storagebits = 16, \
495 .endianness = IIO_BE, \
496 }, \
497 .ext_info = hmc5983_ext_info, \
500 static const struct iio_chan_spec hmc5843_channels[] = {
501 HMC5843_CHANNEL(X, 0),
502 HMC5843_CHANNEL(Y, 1),
503 HMC5843_CHANNEL(Z, 2),
504 IIO_CHAN_SOFT_TIMESTAMP(3),
507 /* Beware: Y and Z are exchanged on HMC5883 and 5983 */
508 static const struct iio_chan_spec hmc5883_channels[] = {
509 HMC5843_CHANNEL(X, 0),
510 HMC5843_CHANNEL(Z, 1),
511 HMC5843_CHANNEL(Y, 2),
512 IIO_CHAN_SOFT_TIMESTAMP(3),
515 static const struct iio_chan_spec hmc5983_channels[] = {
516 HMC5983_CHANNEL(X, 0),
517 HMC5983_CHANNEL(Z, 1),
518 HMC5983_CHANNEL(Y, 2),
519 IIO_CHAN_SOFT_TIMESTAMP(3),
522 static struct attribute *hmc5843_attributes[] = {
523 &iio_dev_attr_scale_available.dev_attr.attr,
524 &iio_dev_attr_sampling_frequency_available.dev_attr.attr,
525 NULL
528 static const struct attribute_group hmc5843_group = {
529 .attrs = hmc5843_attributes,
532 static const struct hmc5843_chip_info hmc5843_chip_info_tbl[] = {
533 [HMC5843_ID] = {
534 .channels = hmc5843_channels,
535 .regval_to_samp_freq = hmc5843_regval_to_samp_freq,
536 .n_regval_to_samp_freq =
537 ARRAY_SIZE(hmc5843_regval_to_samp_freq),
538 .regval_to_nanoscale = hmc5843_regval_to_nanoscale,
539 .n_regval_to_nanoscale =
540 ARRAY_SIZE(hmc5843_regval_to_nanoscale),
542 [HMC5883_ID] = {
543 .channels = hmc5883_channels,
544 .regval_to_samp_freq = hmc5883_regval_to_samp_freq,
545 .n_regval_to_samp_freq =
546 ARRAY_SIZE(hmc5883_regval_to_samp_freq),
547 .regval_to_nanoscale = hmc5883_regval_to_nanoscale,
548 .n_regval_to_nanoscale =
549 ARRAY_SIZE(hmc5883_regval_to_nanoscale),
551 [HMC5883L_ID] = {
552 .channels = hmc5883_channels,
553 .regval_to_samp_freq = hmc5883_regval_to_samp_freq,
554 .n_regval_to_samp_freq =
555 ARRAY_SIZE(hmc5883_regval_to_samp_freq),
556 .regval_to_nanoscale = hmc5883l_regval_to_nanoscale,
557 .n_regval_to_nanoscale =
558 ARRAY_SIZE(hmc5883l_regval_to_nanoscale),
560 [HMC5983_ID] = {
561 .channels = hmc5983_channels,
562 .regval_to_samp_freq = hmc5983_regval_to_samp_freq,
563 .n_regval_to_samp_freq =
564 ARRAY_SIZE(hmc5983_regval_to_samp_freq),
565 .regval_to_nanoscale = hmc5883l_regval_to_nanoscale,
566 .n_regval_to_nanoscale =
567 ARRAY_SIZE(hmc5883l_regval_to_nanoscale),
571 static int hmc5843_init(struct hmc5843_data *data)
573 int ret;
574 u8 id[3];
576 ret = regmap_bulk_read(data->regmap, HMC5843_ID_REG,
577 id, ARRAY_SIZE(id));
578 if (ret < 0)
579 return ret;
580 if (id[0] != 'H' || id[1] != '4' || id[2] != '3') {
581 dev_err(data->dev, "no HMC5843/5883/5883L/5983 sensor\n");
582 return -ENODEV;
585 ret = hmc5843_set_meas_conf(data, HMC5843_MEAS_CONF_NORMAL);
586 if (ret < 0)
587 return ret;
588 ret = hmc5843_set_samp_freq(data, HMC5843_RATE_DEFAULT);
589 if (ret < 0)
590 return ret;
591 ret = hmc5843_set_range_gain(data, HMC5843_RANGE_GAIN_DEFAULT);
592 if (ret < 0)
593 return ret;
594 return hmc5843_set_mode(data, HMC5843_MODE_CONVERSION_CONTINUOUS);
597 static const struct iio_info hmc5843_info = {
598 .attrs = &hmc5843_group,
599 .read_raw = &hmc5843_read_raw,
600 .write_raw = &hmc5843_write_raw,
601 .write_raw_get_fmt = &hmc5843_write_raw_get_fmt,
604 static const unsigned long hmc5843_scan_masks[] = {0x7, 0};
606 int hmc5843_common_suspend(struct device *dev)
608 return hmc5843_set_mode(iio_priv(dev_get_drvdata(dev)),
609 HMC5843_MODE_SLEEP);
611 EXPORT_SYMBOL(hmc5843_common_suspend);
613 int hmc5843_common_resume(struct device *dev)
615 return hmc5843_set_mode(iio_priv(dev_get_drvdata(dev)),
616 HMC5843_MODE_CONVERSION_CONTINUOUS);
618 EXPORT_SYMBOL(hmc5843_common_resume);
620 int hmc5843_common_probe(struct device *dev, struct regmap *regmap,
621 enum hmc5843_ids id, const char *name)
623 struct hmc5843_data *data;
624 struct iio_dev *indio_dev;
625 int ret;
627 indio_dev = devm_iio_device_alloc(dev, sizeof(*data));
628 if (!indio_dev)
629 return -ENOMEM;
631 dev_set_drvdata(dev, indio_dev);
633 /* default settings at probe */
634 data = iio_priv(indio_dev);
635 data->dev = dev;
636 data->regmap = regmap;
637 data->variant = &hmc5843_chip_info_tbl[id];
638 mutex_init(&data->lock);
640 ret = iio_read_mount_matrix(dev, "mount-matrix",
641 &data->orientation);
642 if (ret)
643 return ret;
645 indio_dev->name = name;
646 indio_dev->info = &hmc5843_info;
647 indio_dev->modes = INDIO_DIRECT_MODE;
648 indio_dev->channels = data->variant->channels;
649 indio_dev->num_channels = 4;
650 indio_dev->available_scan_masks = hmc5843_scan_masks;
652 ret = hmc5843_init(data);
653 if (ret < 0)
654 return ret;
656 ret = iio_triggered_buffer_setup(indio_dev, NULL,
657 hmc5843_trigger_handler, NULL);
658 if (ret < 0)
659 goto buffer_setup_err;
661 ret = iio_device_register(indio_dev);
662 if (ret < 0)
663 goto buffer_cleanup;
665 return 0;
667 buffer_cleanup:
668 iio_triggered_buffer_cleanup(indio_dev);
669 buffer_setup_err:
670 hmc5843_set_mode(iio_priv(indio_dev), HMC5843_MODE_SLEEP);
671 return ret;
673 EXPORT_SYMBOL(hmc5843_common_probe);
675 int hmc5843_common_remove(struct device *dev)
677 struct iio_dev *indio_dev = dev_get_drvdata(dev);
679 iio_device_unregister(indio_dev);
680 iio_triggered_buffer_cleanup(indio_dev);
682 /* sleep mode to save power */
683 hmc5843_set_mode(iio_priv(indio_dev), HMC5843_MODE_SLEEP);
685 return 0;
687 EXPORT_SYMBOL(hmc5843_common_remove);
689 MODULE_AUTHOR("Shubhrajyoti Datta <shubhrajyoti@ti.com>");
690 MODULE_DESCRIPTION("HMC5843/5883/5883L/5983 core driver");
691 MODULE_LICENSE("GPL");