Lines Matching full:mc

43 static int mc33880_write_config(struct mc33880 *mc)  in mc33880_write_config()  argument
45 return spi_write(mc->spi, &mc->port_config, sizeof(mc->port_config)); in mc33880_write_config()
49 static int __mc33880_set(struct mc33880 *mc, unsigned offset, int value) in __mc33880_set() argument
52 mc->port_config |= 1 << offset; in __mc33880_set()
54 mc->port_config &= ~(1 << offset); in __mc33880_set()
56 return mc33880_write_config(mc); in __mc33880_set()
62 struct mc33880 *mc = gpiochip_get_data(chip); in mc33880_set() local
64 mutex_lock(&mc->lock); in mc33880_set()
66 __mc33880_set(mc, offset, value); in mc33880_set()
68 mutex_unlock(&mc->lock); in mc33880_set()
73 struct mc33880 *mc; in mc33880_probe() local
92 mc = devm_kzalloc(&spi->dev, sizeof(struct mc33880), GFP_KERNEL); in mc33880_probe()
93 if (!mc) in mc33880_probe()
96 mutex_init(&mc->lock); in mc33880_probe()
98 spi_set_drvdata(spi, mc); in mc33880_probe()
100 mc->spi = spi; in mc33880_probe()
102 mc->chip.label = DRIVER_NAME, in mc33880_probe()
103 mc->chip.set = mc33880_set; in mc33880_probe()
104 mc->chip.base = pdata->base; in mc33880_probe()
105 mc->chip.ngpio = PIN_NUMBER; in mc33880_probe()
106 mc->chip.can_sleep = true; in mc33880_probe()
107 mc->chip.parent = &spi->dev; in mc33880_probe()
108 mc->chip.owner = THIS_MODULE; in mc33880_probe()
110 mc->port_config = 0x00; in mc33880_probe()
115 ret = mc33880_write_config(mc); in mc33880_probe()
116 mc->port_config = 0x00; in mc33880_probe()
118 ret = mc33880_write_config(mc); in mc33880_probe()
126 ret = gpiochip_add_data(&mc->chip, mc); in mc33880_probe()
133 mutex_destroy(&mc->lock); in mc33880_probe()
139 struct mc33880 *mc; in mc33880_remove() local
141 mc = spi_get_drvdata(spi); in mc33880_remove()
143 gpiochip_remove(&mc->chip); in mc33880_remove()
144 mutex_destroy(&mc->lock); in mc33880_remove()