Searched refs:ams_info (Results 1 - 5 of 5) sorted by relevance

/linux-4.4.14/drivers/macintosh/ams/
H A Dams-core.c32 struct ams ams_info; variable in typeref:struct:ams
38 /* Call with ams_info.lock held! */ ams_sensors()
41 u32 orient = ams_info.vflag? ams_info.orient1 : ams_info.orient2; ams_sensors()
45 ams_info.get_xyz(y, x, z); ams_sensors()
47 ams_info.get_xyz(x, y, z); ams_sensors()
62 mutex_lock(&ams_info.lock); ams_show_current()
64 mutex_unlock(&ams_info.lock); ams_show_current()
75 spin_lock(&ams_info.irq_lock); ams_handle_irq()
77 ams_info.worker_irqs |= irq; ams_handle_irq()
78 schedule_work(&ams_info.worker); ams_handle_irq()
80 spin_unlock(&ams_info.irq_lock); ams_handle_irq()
105 mutex_lock(&ams_info.lock); ams_worker()
107 spin_lock_irqsave(&ams_info.irq_lock, flags); ams_worker()
108 irqs_to_clear = ams_info.worker_irqs; ams_worker()
110 if (ams_info.worker_irqs & AMS_IRQ_FREEFALL) { ams_worker()
114 ams_info.worker_irqs &= ~AMS_IRQ_FREEFALL; ams_worker()
117 if (ams_info.worker_irqs & AMS_IRQ_SHOCK) { ams_worker()
121 ams_info.worker_irqs &= ~AMS_IRQ_SHOCK; ams_worker()
124 spin_unlock_irqrestore(&ams_info.irq_lock, flags); ams_worker()
126 ams_info.clear_irq(irqs_to_clear); ams_worker()
128 mutex_unlock(&ams_info.lock); ams_worker()
131 /* Call with ams_info.lock held! */ ams_sensor_attach()
138 prop = of_get_property(ams_info.of_node, "orientation", NULL); ams_sensor_attach()
141 ams_info.orient1 = *prop; ams_sensor_attach()
142 ams_info.orient2 = *(prop + 1); ams_sensor_attach()
145 result = pmf_register_irq_client(ams_info.of_node, ams_sensor_attach()
152 ams_info.worker_irqs = 0; ams_sensor_attach()
155 result = pmf_register_irq_client(ams_info.of_node, ams_sensor_attach()
162 ams_info.of_dev = of_platform_device_create(ams_info.of_node, "ams", NULL); ams_sensor_attach()
163 if (!ams_info.of_dev) { ams_sensor_attach()
169 result = device_create_file(&ams_info.of_dev->dev, &dev_attr_current); ams_sensor_attach()
173 ams_info.vflag = !!(ams_info.get_vendor() & 0x10); ams_sensor_attach()
182 device_remove_file(&ams_info.of_dev->dev, &dev_attr_current); ams_sensor_attach()
184 of_device_unregister(ams_info.of_dev); ams_sensor_attach()
196 spin_lock_init(&ams_info.irq_lock); ams_init()
197 mutex_init(&ams_info.lock); ams_init()
198 INIT_WORK(&ams_info.worker, ams_worker); ams_init()
222 device_remove_file(&ams_info.of_dev->dev, &dev_attr_current); ams_sensor_detach()
226 * We do this after ams_info.exit(), because an interrupt might ams_sensor_detach()
229 flush_work(&ams_info.worker); ams_sensor_detach()
232 of_device_unregister(ams_info.of_dev); ams_sensor_detach()
242 ams_info.exit(); ams_exit()
H A Dams-input.c37 mutex_lock(&ams_info.lock); ams_idev_poll()
41 x -= ams_info.xcalib; ams_idev_poll()
42 y -= ams_info.ycalib; ams_idev_poll()
43 z -= ams_info.zcalib; ams_idev_poll()
51 mutex_unlock(&ams_info.lock); ams_idev_poll()
54 /* Call with ams_info.lock held! */ ams_input_enable()
62 ams_info.xcalib = x; ams_input_enable()
63 ams_info.ycalib = y; ams_input_enable()
64 ams_info.zcalib = z; ams_input_enable()
66 ams_info.idev = input_allocate_polled_device(); ams_input_enable()
67 if (!ams_info.idev) ams_input_enable()
70 ams_info.idev->poll = ams_idev_poll; ams_input_enable()
71 ams_info.idev->poll_interval = 25; ams_input_enable()
73 input = ams_info.idev->input; ams_input_enable()
75 input->id.bustype = ams_info.bustype; ams_input_enable()
77 input->dev.parent = &ams_info.of_dev->dev; ams_input_enable()
87 error = input_register_polled_device(ams_info.idev); ams_input_enable()
89 input_free_polled_device(ams_info.idev); ams_input_enable()
90 ams_info.idev = NULL; ams_input_enable()
101 if (ams_info.idev) { ams_input_disable()
102 input_unregister_polled_device(ams_info.idev); ams_input_disable()
103 input_free_polled_device(ams_info.idev); ams_input_disable()
104 ams_info.idev = NULL; ams_input_disable()
151 return device_create_file(&ams_info.of_dev->dev, &dev_attr_joystick); ams_input_init()
156 device_remove_file(&ams_info.of_dev->dev, &dev_attr_joystick); ams_input_exit()
H A Dams-i2c.c85 return i2c_smbus_read_byte_data(ams_info.i2c_client, reg); ams_i2c_read()
90 return i2c_smbus_write_byte_data(ams_info.i2c_client, reg, value); ams_i2c_write()
170 if (unlikely(ams_info.has_device)) ams_i2c_probe()
173 ams_info.i2c_client = client; ams_i2c_probe()
228 ams_info.has_device = 1; ams_i2c_probe()
240 if (ams_info.has_device) { ams_i2c_remove()
251 ams_info.has_device = 0; ams_i2c_remove()
267 ams_info.of_node = np; ams_i2c_init()
268 ams_info.exit = ams_i2c_exit; ams_i2c_init()
269 ams_info.get_vendor = ams_i2c_get_vendor; ams_i2c_init()
270 ams_info.get_xyz = ams_i2c_get_xyz; ams_i2c_init()
271 ams_info.clear_irq = ams_i2c_clear_irq; ams_i2c_init()
272 ams_info.bustype = BUS_I2C; ams_i2c_init()
H A Dams-pmu.c144 ams_info.has_device = 0; ams_pmu_exit()
155 ams_info.of_node = np; ams_pmu_init()
156 ams_info.exit = ams_pmu_exit; ams_pmu_init()
157 ams_info.get_vendor = ams_pmu_get_vendor; ams_pmu_init()
158 ams_info.get_xyz = ams_pmu_get_xyz; ams_pmu_init()
159 ams_info.clear_irq = ams_pmu_clear_irq; ams_pmu_init()
160 ams_info.bustype = BUS_HOST; ams_pmu_init()
163 prop = of_get_property(ams_info.of_node, "reg", NULL); ams_pmu_init()
193 ams_info.has_device = 1; ams_pmu_init()
H A Dams.h60 extern struct ams ams_info;

Completed in 74 milliseconds