Lines Matching +full:func +full:-
1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
7 * Copyright (c) 2010, ST-Ericsson
52 struct spi_device *func; member
84 if (bus->need_swab) in wfx_spi_copy_from_io()
90 ret = spi_sync(bus->func, &m); in wfx_spi_copy_from_io()
92 if (bus->need_swab && addr == WFX_REG_CONFIG) in wfx_spi_copy_from_io()
123 if (bus->need_swab) in wfx_spi_copy_to_io()
125 if (bus->need_swab && addr == WFX_REG_CONFIG) in wfx_spi_copy_to_io()
132 ret = spi_sync(bus->func, &m); in wfx_spi_copy_to_io()
134 if (bus->need_swab && addr == WFX_REG_CONFIG) in wfx_spi_copy_to_io()
152 wfx_bh_request_rx(bus->core); in wfx_spi_irq_handler()
161 flags = irq_get_trigger_type(bus->func->irq); in wfx_spi_irq_subscribe()
165 return devm_request_threaded_irq(&bus->func->dev, bus->func->irq, NULL, in wfx_spi_irq_subscribe()
173 devm_free_irq(&bus->func->dev, bus->func->irq, bus); in wfx_spi_irq_unsubscribe()
187 device_set_wakeup_enable(&bus->func->dev, enabled); in wfx_spi_set_wakeup()
203 struct spi_device *func = to_spi_device(dev); in wfx_spi_suspend() local
204 struct wfx_spi_priv *bus = spi_get_drvdata(func); in wfx_spi_suspend()
208 flush_work(&bus->core->hif.bh); in wfx_spi_suspend()
209 return enable_irq_wake(func->irq); in wfx_spi_suspend()
214 struct spi_device *func = to_spi_device(dev); in wfx_spi_resume() local
218 return disable_irq_wake(func->irq); in wfx_spi_resume()
221 static int wfx_spi_probe(struct spi_device *func) in wfx_spi_probe() argument
227 if (!func->bits_per_word) in wfx_spi_probe()
228 func->bits_per_word = 16; in wfx_spi_probe()
229 ret = spi_setup(func); in wfx_spi_probe()
232 pdata = (struct wfx_platform_data *)spi_get_device_id(func)->driver_data; in wfx_spi_probe()
234 dev_err(&func->dev, "unable to retrieve driver data (please report)\n"); in wfx_spi_probe()
235 return -ENODEV; in wfx_spi_probe()
239 dev_dbg(&func->dev, "SPI params: CS=%d, mode=%d bits/word=%d speed=%d\n", in wfx_spi_probe()
240 spi_get_chipselect(func, 0), func->mode, func->bits_per_word, func->max_speed_hz); in wfx_spi_probe()
241 if (func->bits_per_word != 16 && func->bits_per_word != 8) in wfx_spi_probe()
242 dev_warn(&func->dev, "unusual bits/word value: %d\n", func->bits_per_word); in wfx_spi_probe()
243 if (func->max_speed_hz > 50000000) in wfx_spi_probe()
244 dev_warn(&func->dev, "%dHz is a very high speed\n", func->max_speed_hz); in wfx_spi_probe()
246 bus = devm_kzalloc(&func->dev, sizeof(*bus), GFP_KERNEL); in wfx_spi_probe()
248 return -ENOMEM; in wfx_spi_probe()
249 bus->func = func; in wfx_spi_probe()
250 if (func->bits_per_word == 8 || IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)) in wfx_spi_probe()
251 bus->need_swab = true; in wfx_spi_probe()
252 spi_set_drvdata(func, bus); in wfx_spi_probe()
254 bus->gpio_reset = devm_gpiod_get_optional(&func->dev, "reset", GPIOD_OUT_LOW); in wfx_spi_probe()
255 if (IS_ERR(bus->gpio_reset)) in wfx_spi_probe()
256 return PTR_ERR(bus->gpio_reset); in wfx_spi_probe()
257 if (!bus->gpio_reset) { in wfx_spi_probe()
258 dev_warn(&func->dev, "gpio reset is not defined, trying to load firmware anyway\n"); in wfx_spi_probe()
260 gpiod_set_consumer_name(bus->gpio_reset, "wfx reset"); in wfx_spi_probe()
261 gpiod_set_value_cansleep(bus->gpio_reset, 1); in wfx_spi_probe()
263 gpiod_set_value_cansleep(bus->gpio_reset, 0); in wfx_spi_probe()
267 bus->core = wfx_init_common(&func->dev, pdata, &wfx_spi_hwbus_ops, bus); in wfx_spi_probe()
268 if (!bus->core) in wfx_spi_probe()
269 return -EIO; in wfx_spi_probe()
271 ret = wfx_probe(bus->core); in wfx_spi_probe()
275 device_set_wakeup_capable(&func->dev, true); in wfx_spi_probe()
279 static void wfx_spi_remove(struct spi_device *func) in wfx_spi_remove() argument
281 struct wfx_spi_priv *bus = spi_get_drvdata(func); in wfx_spi_remove()
283 wfx_release(bus->core); in wfx_spi_remove()
317 .name = "wfx-spi",