Lines Matching refs:moxart_rtc

56 struct moxart_rtc {  struct
69 struct moxart_rtc *moxart_rtc = dev_get_drvdata(dev); in moxart_rtc_write_byte() argument
73 gpiod_set_value(moxart_rtc->gpio_sclk, 0); in moxart_rtc_write_byte()
74 gpiod_set_value(moxart_rtc->gpio_data, ((data & 1) == 1)); in moxart_rtc_write_byte()
76 gpiod_set_value(moxart_rtc->gpio_sclk, 1); in moxart_rtc_write_byte()
83 struct moxart_rtc *moxart_rtc = dev_get_drvdata(dev); in moxart_rtc_read_byte() local
88 gpiod_set_value(moxart_rtc->gpio_sclk, 0); in moxart_rtc_read_byte()
90 gpiod_set_value(moxart_rtc->gpio_sclk, 1); in moxart_rtc_read_byte()
92 if (gpiod_get_value(moxart_rtc->gpio_data)) in moxart_rtc_read_byte()
101 struct moxart_rtc *moxart_rtc = dev_get_drvdata(dev); in moxart_rtc_read_register() local
107 gpiod_direction_output(moxart_rtc->gpio_data, 0); in moxart_rtc_read_register()
108 gpiod_set_value(moxart_rtc->gpio_reset, 1); in moxart_rtc_read_register()
111 gpiod_direction_input(moxart_rtc->gpio_data); in moxart_rtc_read_register()
114 gpiod_set_value(moxart_rtc->gpio_sclk, 0); in moxart_rtc_read_register()
115 gpiod_set_value(moxart_rtc->gpio_reset, 0); in moxart_rtc_read_register()
125 struct moxart_rtc *moxart_rtc = dev_get_drvdata(dev); in moxart_rtc_write_register() local
130 gpiod_direction_output(moxart_rtc->gpio_data, 0); in moxart_rtc_write_register()
131 gpiod_set_value(moxart_rtc->gpio_reset, 1); in moxart_rtc_write_register()
135 gpiod_set_value(moxart_rtc->gpio_sclk, 0); in moxart_rtc_write_register()
136 gpiod_set_value(moxart_rtc->gpio_reset, 0); in moxart_rtc_write_register()
144 struct moxart_rtc *moxart_rtc = dev_get_drvdata(dev); in moxart_rtc_set_time() local
146 spin_lock_irq(&moxart_rtc->rtc_lock); in moxart_rtc_set_time()
175 spin_unlock_irq(&moxart_rtc->rtc_lock); in moxart_rtc_set_time()
187 struct moxart_rtc *moxart_rtc = dev_get_drvdata(dev); in moxart_rtc_read_time() local
190 spin_lock_irq(&moxart_rtc->rtc_lock); in moxart_rtc_read_time()
234 spin_unlock_irq(&moxart_rtc->rtc_lock); in moxart_rtc_read_time()
246 struct moxart_rtc *moxart_rtc; in moxart_rtc_probe() local
249 moxart_rtc = devm_kzalloc(&pdev->dev, sizeof(*moxart_rtc), GFP_KERNEL); in moxart_rtc_probe()
250 if (!moxart_rtc) in moxart_rtc_probe()
253 moxart_rtc->gpio_data = devm_gpiod_get(&pdev->dev, "rtc-data", in moxart_rtc_probe()
255 ret = PTR_ERR_OR_ZERO(moxart_rtc->gpio_data); in moxart_rtc_probe()
261 moxart_rtc->gpio_sclk = devm_gpiod_get(&pdev->dev, "rtc-sclk", in moxart_rtc_probe()
263 ret = PTR_ERR_OR_ZERO(moxart_rtc->gpio_sclk); in moxart_rtc_probe()
269 moxart_rtc->gpio_reset = devm_gpiod_get(&pdev->dev, "rtc-reset", in moxart_rtc_probe()
271 ret = PTR_ERR_OR_ZERO(moxart_rtc->gpio_reset); in moxart_rtc_probe()
277 spin_lock_init(&moxart_rtc->rtc_lock); in moxart_rtc_probe()
278 platform_set_drvdata(pdev, moxart_rtc); in moxart_rtc_probe()
280 moxart_rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, in moxart_rtc_probe()
283 if (IS_ERR(moxart_rtc->rtc)) { in moxart_rtc_probe()
285 return PTR_ERR(moxart_rtc->rtc); in moxart_rtc_probe()