Lines Matching +full:3 +full:- +full:inch
1 // SPDX-License-Identifier: GPL-2.0
36 #define PA_LCD_UD BIT(3)
45 #define PC_RST_BRIDGE_N BIT(3)
68 u8 port_states[3];
83 state->port_states[reg - REG_PORTA] = val; in attiny_set_port_state()
84 return regmap_write(state->regmap, reg, val); in attiny_set_port_state()
89 return state->port_states[reg - REG_PORTA]; in attiny_get_port_state()
96 mutex_lock(&state->lock); in attiny_lcd_power_enable()
117 mutex_unlock(&state->lock); in attiny_lcd_power_enable()
126 mutex_lock(&state->lock); in attiny_lcd_power_disable()
128 regmap_write(rdev->regmap, REG_PWM, 0); in attiny_lcd_power_disable()
138 mutex_unlock(&state->lock); in attiny_lcd_power_disable()
149 mutex_lock(&state->lock); in attiny_lcd_power_is_enabled()
152 ret = regmap_read(rdev->regmap, REG_PORTC, &data); in attiny_lcd_power_is_enabled()
158 mutex_unlock(&state->lock); in attiny_lcd_power_is_enabled()
179 .name = "tc358762-power",
188 struct regmap *regmap = state->regmap; in attiny_update_status()
192 mutex_lock(&state->lock); in attiny_update_status()
200 mutex_unlock(&state->lock); in attiny_update_status()
222 mutex_lock(&state->lock); in attiny_gpio_set()
234 regmap_write(state->regmap, REG_ADDR_H, 0x04); in attiny_gpio_set()
236 regmap_write(state->regmap, REG_ADDR_L, 0x7c); in attiny_gpio_set()
238 regmap_write(state->regmap, REG_WRITE_DATA_H, 0x00); in attiny_gpio_set()
240 regmap_write(state->regmap, REG_WRITE_DATA_L, 0x00); in attiny_gpio_set()
245 mutex_unlock(&state->lock); in attiny_gpio_set()
256 msgs[0].addr = client->addr; in attiny_i2c_read()
261 ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); in attiny_i2c_read()
263 return -EIO; in attiny_i2c_read()
268 msgs[0].addr = client->addr; in attiny_i2c_read()
273 ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); in attiny_i2c_read()
275 return -EIO; in attiny_i2c_read()
295 state = devm_kzalloc(&i2c->dev, sizeof(*state), GFP_KERNEL); in attiny_i2c_probe()
297 return -ENOMEM; in attiny_i2c_probe()
299 mutex_init(&state->lock); in attiny_i2c_probe()
305 dev_err(&i2c->dev, "Failed to allocate register map: %d\n", in attiny_i2c_probe()
312 dev_err(&i2c->dev, "Failed to read REG_ID reg: %d\n", ret); in attiny_i2c_probe()
321 dev_err(&i2c->dev, "Unknown Atmel firmware revision: 0x%02x\n", data); in attiny_i2c_probe()
322 ret = -ENODEV; in attiny_i2c_probe()
330 config.dev = &i2c->dev; in attiny_i2c_probe()
332 config.of_node = i2c->dev.of_node; in attiny_i2c_probe()
336 rdev = devm_regulator_register(&i2c->dev, &attiny_regulator, &config); in attiny_i2c_probe()
338 dev_err(&i2c->dev, "Failed to register ATTINY regulator\n"); in attiny_i2c_probe()
346 state->regmap = regmap; in attiny_i2c_probe()
348 bl = devm_backlight_device_register(&i2c->dev, dev_name(&i2c->dev), in attiny_i2c_probe()
349 &i2c->dev, state, &attiny_bl, in attiny_i2c_probe()
356 bl->props.brightness = 0xff; in attiny_i2c_probe()
358 state->gc.parent = &i2c->dev; in attiny_i2c_probe()
359 state->gc.label = i2c->name; in attiny_i2c_probe()
360 state->gc.owner = THIS_MODULE; in attiny_i2c_probe()
361 state->gc.base = -1; in attiny_i2c_probe()
362 state->gc.ngpio = NUM_GPIO; in attiny_i2c_probe()
364 state->gc.set = attiny_gpio_set; in attiny_i2c_probe()
365 state->gc.get_direction = attiny_gpio_get_direction; in attiny_i2c_probe()
366 state->gc.can_sleep = true; in attiny_i2c_probe()
368 ret = devm_gpiochip_add_data(&i2c->dev, &state->gc, state); in attiny_i2c_probe()
370 dev_err(&i2c->dev, "Failed to create gpiochip: %d\n", ret); in attiny_i2c_probe()
377 mutex_destroy(&state->lock); in attiny_i2c_probe()
386 mutex_destroy(&state->lock); in attiny_i2c_remove()
390 { .compatible = "raspberrypi,7inch-touchscreen-panel-regulator" },
408 MODULE_DESCRIPTION("Regulator device driver for Raspberry Pi 7-inch touchscreen");