Lines Matching refs:mh248

43 	struct mh248_para *mh248;  in hall_fb_notifier_callback()  local
46 mh248 = container_of(self, struct mh248_para, fb_notif); in hall_fb_notifier_callback()
51 mutex_lock(&mh248->ops_lock); in hall_fb_notifier_callback()
54 mh248->is_suspend = 0; in hall_fb_notifier_callback()
57 mh248->is_suspend = 1; in hall_fb_notifier_callback()
60 mutex_unlock(&mh248->ops_lock); in hall_fb_notifier_callback()
67 struct mh248_para *mh248 = (struct mh248_para *)dev_id; in hall_mh248_interrupt() local
70 gpio_value = gpio_get_value(mh248->gpio_pin); in hall_mh248_interrupt()
71 if ((gpio_value != mh248->active_value) && in hall_mh248_interrupt()
72 (mh248->is_suspend == 0)) { in hall_mh248_interrupt()
73 input_report_key(mh248->hall_input, KEY_POWER, 1); in hall_mh248_interrupt()
74 input_sync(mh248->hall_input); in hall_mh248_interrupt()
75 input_report_key(mh248->hall_input, KEY_POWER, 0); in hall_mh248_interrupt()
76 input_sync(mh248->hall_input); in hall_mh248_interrupt()
77 } else if ((gpio_value == mh248->active_value) && in hall_mh248_interrupt()
78 (mh248->is_suspend == 1)) { in hall_mh248_interrupt()
79 input_report_key(mh248->hall_input, KEY_WAKEUP, 1); in hall_mh248_interrupt()
80 input_sync(mh248->hall_input); in hall_mh248_interrupt()
81 input_report_key(mh248->hall_input, KEY_WAKEUP, 0); in hall_mh248_interrupt()
82 input_sync(mh248->hall_input); in hall_mh248_interrupt()
91 struct mh248_para *mh248; in hall_mh248_probe() local
96 mh248 = devm_kzalloc(&pdev->dev, sizeof(*mh248), GFP_KERNEL); in hall_mh248_probe()
97 if (!mh248) in hall_mh248_probe()
100 mh248->dev = &pdev->dev; in hall_mh248_probe()
102 mh248->gpio_pin = of_get_named_gpio_flags(np, "irq-gpio", in hall_mh248_probe()
104 if (!gpio_is_valid(mh248->gpio_pin)) { in hall_mh248_probe()
105 dev_err(mh248->dev, "Can not read property irq-gpio\n"); in hall_mh248_probe()
106 return mh248->gpio_pin; in hall_mh248_probe()
108 mh248->irq = gpio_to_irq(mh248->gpio_pin); in hall_mh248_probe()
111 mh248->active_value = hallactive; in hall_mh248_probe()
112 mh248->is_suspend = 0; in hall_mh248_probe()
113 mutex_init(&mh248->ops_lock); in hall_mh248_probe()
115 ret = devm_gpio_request_one(mh248->dev, mh248->gpio_pin, in hall_mh248_probe()
118 dev_err(mh248->dev, "fail to request gpio:%d\n", mh248->gpio_pin); in hall_mh248_probe()
122 ret = devm_request_threaded_irq(mh248->dev, mh248->irq, in hall_mh248_probe()
125 "hall_mh248", mh248); in hall_mh248_probe()
127 dev_err(mh248->dev, "request irq(%d) failed, ret=%d\n", in hall_mh248_probe()
128 mh248->irq, ret); in hall_mh248_probe()
132 mh248->hall_input = devm_input_allocate_device(&pdev->dev); in hall_mh248_probe()
133 if (!mh248->hall_input) { in hall_mh248_probe()
137 mh248->hall_input->name = "hall wake key"; in hall_mh248_probe()
138 input_set_capability(mh248->hall_input, EV_KEY, KEY_POWER); in hall_mh248_probe()
139 input_set_capability(mh248->hall_input, EV_KEY, KEY_WAKEUP); in hall_mh248_probe()
141 ret = input_register_device(mh248->hall_input); in hall_mh248_probe()
147 enable_irq_wake(mh248->irq); in hall_mh248_probe()
148 mh248->fb_notif.notifier_call = hall_fb_notifier_callback; in hall_mh248_probe()
149 fb_register_client(&mh248->fb_notif); in hall_mh248_probe()
150 dev_info(mh248->dev, "hall_mh248_probe success.\n"); in hall_mh248_probe()