Lines Matching full: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()
96 static int nspire_keypad_chip_init(struct nspire_keypad *keypad) in nspire_keypad_chip_init() argument
100 cycles_per_us = (clk_get_rate(keypad->clk) / 1000000); in nspire_keypad_chip_init()
104 delay_cycles = cycles_per_us * keypad->scan_interval; in nspire_keypad_chip_init()
108 row_delay_cycles = cycles_per_us * keypad->row_delay; in nspire_keypad_chip_init()
115 writel(val, keypad->reg_base + KEYPAD_SCAN_MODE); in nspire_keypad_chip_init()
118 writel(val, keypad->reg_base + KEYPAD_CNTL); in nspire_keypad_chip_init()
121 keypad->int_mask = 1 << 1; in nspire_keypad_chip_init()
122 writel(keypad->int_mask, keypad->reg_base + KEYPAD_INTMSK); in nspire_keypad_chip_init()
126 writel(0, keypad->reg_base + KEYPAD_UNKNOWN_INT); in nspire_keypad_chip_init()
128 writel(~0, keypad->reg_base + KEYPAD_UNKNOWN_INT_STS); in nspire_keypad_chip_init()
135 struct nspire_keypad *keypad = input_get_drvdata(input); in nspire_keypad_open() local
138 error = clk_prepare_enable(keypad->clk); in nspire_keypad_open()
142 error = nspire_keypad_chip_init(keypad); in nspire_keypad_open()
144 clk_disable_unprepare(keypad->clk); in nspire_keypad_open()
153 struct nspire_keypad *keypad = input_get_drvdata(input); in nspire_keypad_close() local
155 clk_disable_unprepare(keypad->clk); in nspire_keypad_close()
161 struct nspire_keypad *keypad; in nspire_keypad_probe() local
171 keypad = devm_kzalloc(&pdev->dev, sizeof(struct nspire_keypad), in nspire_keypad_probe()
173 if (!keypad) { in nspire_keypad_probe()
174 dev_err(&pdev->dev, "failed to allocate keypad memory\n"); in nspire_keypad_probe()
178 keypad->row_shift = get_count_order(KEYPAD_BITMASK_COLS); in nspire_keypad_probe()
181 &keypad->scan_interval); in nspire_keypad_probe()
188 &keypad->row_delay); in nspire_keypad_probe()
194 keypad->active_low = of_property_read_bool(of_node, "active-low"); in nspire_keypad_probe()
196 keypad->clk = devm_clk_get(&pdev->dev, NULL); in nspire_keypad_probe()
197 if (IS_ERR(keypad->clk)) { in nspire_keypad_probe()
199 return PTR_ERR(keypad->clk); in nspire_keypad_probe()
203 keypad->reg_base = devm_ioremap_resource(&pdev->dev, res); in nspire_keypad_probe()
204 if (IS_ERR(keypad->reg_base)) in nspire_keypad_probe()
205 return PTR_ERR(keypad->reg_base); in nspire_keypad_probe()
207 keypad->input = input = devm_input_allocate_device(&pdev->dev); in nspire_keypad_probe()
213 input_set_drvdata(input, keypad); in nspire_keypad_probe()
216 input->name = "nspire-keypad"; in nspire_keypad_probe()
234 "nspire_keypad", keypad); in nspire_keypad_probe()
248 "TI-NSPIRE keypad at %pR (scan_interval=%uus, row_delay=%uus%s)\n", in nspire_keypad_probe()
249 res, keypad->row_delay, keypad->scan_interval, in nspire_keypad_probe()
250 keypad->active_low ? ", active_low" : ""); in nspire_keypad_probe()
256 { .compatible = "ti,nspire-keypad" },
263 .name = "nspire-keypad",
272 MODULE_DESCRIPTION("TI-NSPIRE Keypad Driver");