24 #include <linux/module.h>
26 #include <linux/slab.h>
27 #include <linux/i2c.h>
54 ret = compass_command(c, map[val]);
64 return compass_store(dev, buf, count,
"EC");
70 return compass_store(dev, buf, count,
"SW");
81 ret = compass_command(client,
'A');
90 dev_warn(dev,
"i2c read data cmd failed\n");
93 ret = (i2c_data[0] << 8) | i2c_data[1];
94 return sprintf(buf,
"%d.%d\n", ret/10, ret%10);
102 static struct attribute *mid_att_compass[] = {
103 &dev_attr_heading0_input.attr,
104 &dev_attr_calibration.attr,
105 &dev_attr_power_state.attr,
111 .attrs = mid_att_compass
114 static int hmc6352_probe(
struct i2c_client *client,
121 dev_err(&client->
dev,
"device_create_file failed\n");
124 dev_info(&client->
dev,
"%s HMC6352 compass chip found\n",
129 static int hmc6352_remove(
struct i2c_client *client)
146 .probe = hmc6352_probe,
147 .remove = hmc6352_remove,
148 .id_table = hmc6352_id,