Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: wilc1000: look for rtc_clk clock

If rtc_clk is provided from DT, use it and enable it.
This is optional.
The signal may be hardcoded and no need to be requested,
but if DT provides it, use it.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Acked-by: Ajay Singh <ajay.kathat@microchip.com>
Link: https://lore.kernel.org/r/1568037993-4646-2-git-send-email-eugen.hristev@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Eugen Hristev and committed by
Greg Kroah-Hartman
8692b047 ae8779e1

+15
+14
drivers/staging/wilc1000/wilc_sdio.c
··· 4 4 * All rights reserved. 5 5 */ 6 6 7 + #include <linux/clk.h> 7 8 #include <linux/mmc/sdio_func.h> 8 9 #include <linux/mmc/host.h> 9 10 ··· 152 151 wilc->dev = &func->dev; 153 152 wilc->gpio_irq = gpio; 154 153 154 + wilc->rtc_clk = devm_clk_get(&func->card->dev, "rtc_clk"); 155 + if (PTR_ERR_OR_ZERO(wilc->rtc_clk) == -EPROBE_DEFER) 156 + return -EPROBE_DEFER; 157 + else if (!IS_ERR(wilc->rtc_clk)) 158 + clk_prepare_enable(wilc->rtc_clk); 159 + 155 160 dev_info(&func->dev, "Driver Initializing success\n"); 156 161 return 0; 157 162 } ··· 169 162 /* free the GPIO in module remove */ 170 163 if (wilc->gpio_irq) 171 164 gpiod_put(wilc->gpio_irq); 165 + 166 + if (!IS_ERR(wilc->rtc_clk)) 167 + clk_disable_unprepare(wilc->rtc_clk); 168 + 172 169 wilc_netdev_cleanup(wilc); 173 170 } 174 171 ··· 203 192 204 193 dev_info(dev, "sdio suspend\n"); 205 194 chip_wakeup(wilc); 195 + 196 + if (!IS_ERR(wilc->rtc_clk)) 197 + clk_disable_unprepare(wilc->rtc_clk); 206 198 207 199 if (wilc->suspend_event) { 208 200 host_sleep_notify(wilc);
+1
drivers/staging/wilc1000/wilc_wfi_netdevice.h
··· 216 216 int io_type; 217 217 s8 mac_status; 218 218 struct gpio_desc *gpio_irq; 219 + struct clk *rtc_clk; 219 220 bool initialized; 220 221 int dev_irq_num; 221 222 int close;