Lines Matching refs:dev

25 	struct adp5520_gpio *dev;  in adp5520_gpio_get_value()  local
28 dev = gpiochip_get_data(chip); in adp5520_gpio_get_value()
35 if (test_bit(off, &dev->output)) in adp5520_gpio_get_value()
36 adp5520_read(dev->master, ADP5520_GPIO_OUT, &reg_val); in adp5520_gpio_get_value()
38 adp5520_read(dev->master, ADP5520_GPIO_IN, &reg_val); in adp5520_gpio_get_value()
40 return !!(reg_val & dev->lut[off]); in adp5520_gpio_get_value()
46 struct adp5520_gpio *dev; in adp5520_gpio_set_value() local
47 dev = gpiochip_get_data(chip); in adp5520_gpio_set_value()
50 adp5520_set_bits(dev->master, ADP5520_GPIO_OUT, dev->lut[off]); in adp5520_gpio_set_value()
52 adp5520_clr_bits(dev->master, ADP5520_GPIO_OUT, dev->lut[off]); in adp5520_gpio_set_value()
57 struct adp5520_gpio *dev; in adp5520_gpio_direction_input() local
58 dev = gpiochip_get_data(chip); in adp5520_gpio_direction_input()
60 clear_bit(off, &dev->output); in adp5520_gpio_direction_input()
62 return adp5520_clr_bits(dev->master, ADP5520_GPIO_CFG_2, in adp5520_gpio_direction_input()
63 dev->lut[off]); in adp5520_gpio_direction_input()
69 struct adp5520_gpio *dev; in adp5520_gpio_direction_output() local
71 dev = gpiochip_get_data(chip); in adp5520_gpio_direction_output()
73 set_bit(off, &dev->output); in adp5520_gpio_direction_output()
76 ret |= adp5520_set_bits(dev->master, ADP5520_GPIO_OUT, in adp5520_gpio_direction_output()
77 dev->lut[off]); in adp5520_gpio_direction_output()
79 ret |= adp5520_clr_bits(dev->master, ADP5520_GPIO_OUT, in adp5520_gpio_direction_output()
80 dev->lut[off]); in adp5520_gpio_direction_output()
82 ret |= adp5520_set_bits(dev->master, ADP5520_GPIO_CFG_2, in adp5520_gpio_direction_output()
83 dev->lut[off]); in adp5520_gpio_direction_output()
90 struct adp5520_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev); in adp5520_gpio_probe()
91 struct adp5520_gpio *dev; in adp5520_gpio_probe() local
97 dev_err(&pdev->dev, "missing platform data\n"); in adp5520_gpio_probe()
102 dev_err(&pdev->dev, "only ADP5520 supports GPIO\n"); in adp5520_gpio_probe()
106 dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); in adp5520_gpio_probe()
107 if (dev == NULL) in adp5520_gpio_probe()
110 dev->master = pdev->dev.parent; in adp5520_gpio_probe()
114 dev->lut[gpios++] = 1 << i; in adp5520_gpio_probe()
119 gc = &dev->gpio_chip; in adp5520_gpio_probe()
131 ret = adp5520_clr_bits(dev->master, ADP5520_GPIO_CFG_1, in adp5520_gpio_probe()
141 ret = adp5520_set_bits(dev->master, ADP5520_LED_CONTROL, in adp5520_gpio_probe()
144 ret |= adp5520_set_bits(dev->master, ADP5520_GPIO_PULLUP, in adp5520_gpio_probe()
148 dev_err(&pdev->dev, "failed to write\n"); in adp5520_gpio_probe()
152 return devm_gpiochip_add_data(&pdev->dev, &dev->gpio_chip, dev); in adp5520_gpio_probe()