Lines Matching +full:vf610 +full:- +full:dac

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Freescale Vybrid vf610 DAC driver
47 info->conv_mode = VF610_DAC_CONV_LOW_POWER; in vf610_dac_init()
50 writel(val, info->regs + VF610_DACx_STATCTRL); in vf610_dac_init()
57 val = readl(info->regs + VF610_DACx_STATCTRL); in vf610_dac_exit()
59 writel(val, info->regs + VF610_DACx_STATCTRL); in vf610_dac_exit()
69 mutex_lock(&info->lock); in vf610_set_conversion_mode()
70 info->conv_mode = mode; in vf610_set_conversion_mode()
71 val = readl(info->regs + VF610_DACx_STATCTRL); in vf610_set_conversion_mode()
76 writel(val, info->regs + VF610_DACx_STATCTRL); in vf610_set_conversion_mode()
77 mutex_unlock(&info->lock); in vf610_set_conversion_mode()
87 return info->conv_mode; in vf610_get_conversion_mode()
90 static const char * const vf610_conv_modes[] = { "high-power", "low-power" };
126 *val = VF610_DAC_DAT0(readl(info->regs)); in vf610_read_raw()
139 return -EINVAL; in vf610_read_raw()
152 mutex_lock(&info->lock); in vf610_write_raw()
153 writel(VF610_DAC_DAT0(val), info->regs); in vf610_write_raw()
154 mutex_unlock(&info->lock); in vf610_write_raw()
158 return -EINVAL; in vf610_write_raw()
168 { .compatible = "fsl,vf610-dac", },
179 indio_dev = devm_iio_device_alloc(&pdev->dev, in vf610_dac_probe()
182 dev_err(&pdev->dev, "Failed allocating iio device\n"); in vf610_dac_probe()
183 return -ENOMEM; in vf610_dac_probe()
187 info->dev = &pdev->dev; in vf610_dac_probe()
189 info->regs = devm_platform_ioremap_resource(pdev, 0); in vf610_dac_probe()
190 if (IS_ERR(info->regs)) in vf610_dac_probe()
191 return PTR_ERR(info->regs); in vf610_dac_probe()
193 info->clk = devm_clk_get(&pdev->dev, "dac"); in vf610_dac_probe()
194 if (IS_ERR(info->clk)) { in vf610_dac_probe()
195 dev_err(&pdev->dev, "Failed getting clock, err = %ld\n", in vf610_dac_probe()
196 PTR_ERR(info->clk)); in vf610_dac_probe()
197 return PTR_ERR(info->clk); in vf610_dac_probe()
202 indio_dev->name = dev_name(&pdev->dev); in vf610_dac_probe()
203 indio_dev->info = &vf610_dac_iio_info; in vf610_dac_probe()
204 indio_dev->modes = INDIO_DIRECT_MODE; in vf610_dac_probe()
205 indio_dev->channels = vf610_dac_iio_channels; in vf610_dac_probe()
206 indio_dev->num_channels = ARRAY_SIZE(vf610_dac_iio_channels); in vf610_dac_probe()
208 mutex_init(&info->lock); in vf610_dac_probe()
210 ret = clk_prepare_enable(info->clk); in vf610_dac_probe()
212 dev_err(&pdev->dev, in vf610_dac_probe()
221 dev_err(&pdev->dev, "Couldn't register the device\n"); in vf610_dac_probe()
229 clk_disable_unprepare(info->clk); in vf610_dac_probe()
241 clk_disable_unprepare(info->clk); in vf610_dac_remove()
252 clk_disable_unprepare(info->clk); in vf610_dac_suspend()
263 ret = clk_prepare_enable(info->clk); in vf610_dac_resume()
279 .name = "vf610-dac",
287 MODULE_DESCRIPTION("Freescale VF610 DAC driver");