Lines Matching refs:keypad
52 struct nspire_keypad *keypad = dev_id; in nspire_keypad_irq() local
53 struct input_dev *input = keypad->input; in nspire_keypad_irq()
61 int_sts = readl(keypad->reg_base + KEYPAD_INT) & keypad->int_mask; in nspire_keypad_irq()
65 memcpy_fromio(state, keypad->reg_base + KEYPAD_DATA, sizeof(state)); in nspire_keypad_irq()
69 if (keypad->active_low) in nspire_keypad_irq()
72 changed = bits ^ keypad->state[row]; in nspire_keypad_irq()
76 keypad->state[row] = bits; in nspire_keypad_irq()
82 code = MATRIX_SCAN_CODE(row, col, keypad->row_shift); in nspire_keypad_irq()
91 writel(0x3, keypad->reg_base + KEYPAD_INT); in nspire_keypad_irq()
98 struct nspire_keypad *keypad = input_get_drvdata(input); in nspire_keypad_open() local
102 error = clk_prepare_enable(keypad->clk); in nspire_keypad_open()
106 cycles_per_us = (clk_get_rate(keypad->clk) / 1000000); in nspire_keypad_open()
110 delay_cycles = cycles_per_us * keypad->scan_interval; in nspire_keypad_open()
114 row_delay_cycles = cycles_per_us * keypad->row_delay; in nspire_keypad_open()
121 writel(val, keypad->reg_base + KEYPAD_SCAN_MODE); in nspire_keypad_open()
124 writel(val, keypad->reg_base + KEYPAD_CNTL); in nspire_keypad_open()
127 keypad->int_mask = 1 << 1; in nspire_keypad_open()
128 writel(keypad->int_mask, keypad->reg_base + KEYPAD_INTMSK); in nspire_keypad_open()
135 struct nspire_keypad *keypad = input_get_drvdata(input); in nspire_keypad_close() local
138 writel(0, keypad->reg_base + KEYPAD_INTMSK); in nspire_keypad_close()
140 writel(~0, keypad->reg_base + KEYPAD_INT); in nspire_keypad_close()
142 clk_disable_unprepare(keypad->clk); in nspire_keypad_close()
148 struct nspire_keypad *keypad; in nspire_keypad_probe() local
158 keypad = devm_kzalloc(&pdev->dev, sizeof(struct nspire_keypad), in nspire_keypad_probe()
160 if (!keypad) { in nspire_keypad_probe()
165 keypad->row_shift = get_count_order(KEYPAD_BITMASK_COLS); in nspire_keypad_probe()
168 &keypad->scan_interval); in nspire_keypad_probe()
175 &keypad->row_delay); in nspire_keypad_probe()
181 keypad->active_low = of_property_read_bool(of_node, "active-low"); in nspire_keypad_probe()
183 keypad->clk = devm_clk_get(&pdev->dev, NULL); in nspire_keypad_probe()
184 if (IS_ERR(keypad->clk)) { in nspire_keypad_probe()
186 return PTR_ERR(keypad->clk); in nspire_keypad_probe()
189 keypad->reg_base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); in nspire_keypad_probe()
190 if (IS_ERR(keypad->reg_base)) in nspire_keypad_probe()
191 return PTR_ERR(keypad->reg_base); in nspire_keypad_probe()
193 keypad->input = input = devm_input_allocate_device(&pdev->dev); in nspire_keypad_probe()
199 error = clk_prepare_enable(keypad->clk); in nspire_keypad_probe()
206 writel(0, keypad->reg_base + KEYPAD_INTMSK); in nspire_keypad_probe()
208 writel(~0, keypad->reg_base + KEYPAD_INT); in nspire_keypad_probe()
212 writel(0, keypad->reg_base + KEYPAD_UNKNOWN_INT); in nspire_keypad_probe()
214 writel(~0, keypad->reg_base + KEYPAD_UNKNOWN_INT_STS); in nspire_keypad_probe()
216 clk_disable_unprepare(keypad->clk); in nspire_keypad_probe()
218 input_set_drvdata(input, keypad); in nspire_keypad_probe()
239 "nspire_keypad", keypad); in nspire_keypad_probe()
254 res, keypad->row_delay, keypad->scan_interval, in nspire_keypad_probe()
255 keypad->active_low ? ", active_low" : ""); in nspire_keypad_probe()