Lines Matching +full:syscon +full:- +full:dev

1 // SPDX-License-Identifier: GPL-2.0-or-later
17 #include <linux/mfd/syscon.h>
18 #include <linux/mfd/syscon/clps711x.h>
28 struct regmap *syscon; member
36 const unsigned short *keycodes = input->keycode; in clps711x_keypad_poll()
43 regmap_update_bits(priv->syscon, SYSCON_OFFSET, in clps711x_keypad_poll()
48 for (row = 0; row < priv->row_count; row++) { in clps711x_keypad_poll()
49 struct clps711x_gpio_data *data = &priv->gpio_data[row]; in clps711x_keypad_poll()
54 state = gpiod_get_value_cansleep(data->desc); in clps711x_keypad_poll()
56 state1 = gpiod_get_value_cansleep(data->desc); in clps711x_keypad_poll()
59 if (test_bit(col, data->last_state) != state) { in clps711x_keypad_poll()
61 priv->row_shift); in clps711x_keypad_poll()
64 set_bit(col, data->last_state); in clps711x_keypad_poll()
68 clear_bit(col, data->last_state); in clps711x_keypad_poll()
79 regmap_update_bits(priv->syscon, SYSCON_OFFSET, in clps711x_keypad_poll()
90 struct device *dev = &pdev->dev; in clps711x_keypad_probe() local
95 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); in clps711x_keypad_probe()
97 return -ENOMEM; in clps711x_keypad_probe()
99 priv->syscon = syscon_regmap_lookup_by_phandle(dev->of_node, "syscon"); in clps711x_keypad_probe()
100 if (IS_ERR(priv->syscon)) in clps711x_keypad_probe()
101 return PTR_ERR(priv->syscon); in clps711x_keypad_probe()
103 priv->row_count = gpiod_count(dev, "row"); in clps711x_keypad_probe()
104 if (priv->row_count < 1) in clps711x_keypad_probe()
105 return -EINVAL; in clps711x_keypad_probe()
107 priv->gpio_data = devm_kcalloc(dev, in clps711x_keypad_probe()
108 priv->row_count, sizeof(*priv->gpio_data), in clps711x_keypad_probe()
110 if (!priv->gpio_data) in clps711x_keypad_probe()
111 return -ENOMEM; in clps711x_keypad_probe()
113 priv->row_shift = get_count_order(CLPS711X_KEYPAD_COL_COUNT); in clps711x_keypad_probe()
115 for (i = 0; i < priv->row_count; i++) { in clps711x_keypad_probe()
116 struct clps711x_gpio_data *data = &priv->gpio_data[i]; in clps711x_keypad_probe()
118 data->desc = devm_gpiod_get_index(dev, "row", i, GPIOD_IN); in clps711x_keypad_probe()
119 if (IS_ERR(data->desc)) in clps711x_keypad_probe()
120 return PTR_ERR(data->desc); in clps711x_keypad_probe()
123 err = device_property_read_u32(dev, "poll-interval", &poll_interval); in clps711x_keypad_probe()
127 input = devm_input_allocate_device(dev); in clps711x_keypad_probe()
129 return -ENOMEM; in clps711x_keypad_probe()
133 input->name = pdev->name; in clps711x_keypad_probe()
134 input->dev.parent = dev; in clps711x_keypad_probe()
135 input->id.bustype = BUS_HOST; in clps711x_keypad_probe()
136 input->id.vendor = 0x0001; in clps711x_keypad_probe()
137 input->id.product = 0x0001; in clps711x_keypad_probe()
138 input->id.version = 0x0100; in clps711x_keypad_probe()
140 err = matrix_keypad_build_keymap(NULL, NULL, priv->row_count, in clps711x_keypad_probe()
147 if (device_property_read_bool(dev, "autorepeat")) in clps711x_keypad_probe()
148 __set_bit(EV_REP, input->evbit); in clps711x_keypad_probe()
151 regmap_update_bits(priv->syscon, SYSCON_OFFSET, SYSCON1_KBDSCAN_MASK, in clps711x_keypad_probe()
169 { .compatible = "cirrus,ep7209-keypad", },
176 .name = "clps711x-keypad",