zpa2326.c (762f99f4f3cb41a775b5157dd761217beba65873) zpa2326.c (c8629ec92cb2a2e24bed4509d13c88b0cf5525c4)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Murata ZPA2326 pressure and temperature sensor IIO driver
4 *
5 * Copyright (c) 2016 Parrot S.A.
6 *
7 * Author: Gregor Boirie <gregor.boirie@parrot.com>
8 */

--- 148 unchanged lines hidden (view full) ---

157 case ZPA2326_THS_P_LOW_REG:
158 case ZPA2326_THS_P_HIGH_REG:
159 return true;
160
161 default:
162 return false;
163 }
164}
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Murata ZPA2326 pressure and temperature sensor IIO driver
4 *
5 * Copyright (c) 2016 Parrot S.A.
6 *
7 * Author: Gregor Boirie <gregor.boirie@parrot.com>
8 */

--- 148 unchanged lines hidden (view full) ---

157 case ZPA2326_THS_P_LOW_REG:
158 case ZPA2326_THS_P_HIGH_REG:
159 return true;
160
161 default:
162 return false;
163 }
164}
165EXPORT_SYMBOL_GPL(zpa2326_isreg_writeable);
165EXPORT_SYMBOL_NS_GPL(zpa2326_isreg_writeable, IIO_ZPA2326);
166
167bool zpa2326_isreg_readable(struct device *dev, unsigned int reg)
168{
169 switch (reg) {
170 case ZPA2326_REF_P_XL_REG:
171 case ZPA2326_REF_P_L_REG:
172 case ZPA2326_REF_P_H_REG:
173 case ZPA2326_DEVICE_ID_REG:

--- 12 unchanged lines hidden (view full) ---

186 case ZPA2326_TEMP_OUT_L_REG:
187 case ZPA2326_TEMP_OUT_H_REG:
188 return true;
189
190 default:
191 return false;
192 }
193}
166
167bool zpa2326_isreg_readable(struct device *dev, unsigned int reg)
168{
169 switch (reg) {
170 case ZPA2326_REF_P_XL_REG:
171 case ZPA2326_REF_P_L_REG:
172 case ZPA2326_REF_P_H_REG:
173 case ZPA2326_DEVICE_ID_REG:

--- 12 unchanged lines hidden (view full) ---

186 case ZPA2326_TEMP_OUT_L_REG:
187 case ZPA2326_TEMP_OUT_H_REG:
188 return true;
189
190 default:
191 return false;
192 }
193}
194EXPORT_SYMBOL_GPL(zpa2326_isreg_readable);
194EXPORT_SYMBOL_NS_GPL(zpa2326_isreg_readable, IIO_ZPA2326);
195
196bool zpa2326_isreg_precious(struct device *dev, unsigned int reg)
197{
198 switch (reg) {
199 case ZPA2326_INT_SOURCE_REG:
200 case ZPA2326_PRESS_OUT_H_REG:
201 return true;
202
203 default:
204 return false;
205 }
206}
195
196bool zpa2326_isreg_precious(struct device *dev, unsigned int reg)
197{
198 switch (reg) {
199 case ZPA2326_INT_SOURCE_REG:
200 case ZPA2326_PRESS_OUT_H_REG:
201 return true;
202
203 default:
204 return false;
205 }
206}
207EXPORT_SYMBOL_GPL(zpa2326_isreg_precious);
207EXPORT_SYMBOL_NS_GPL(zpa2326_isreg_precious, IIO_ZPA2326);
208
209/**
210 * zpa2326_enable_device() - Enable device, i.e. get out of low power mode.
211 * @indio_dev: The IIO device associated with the hardware to enable.
212 *
213 * Required to access complete register space and to perform any sampling
214 * or control operations.
215 *

--- 428 unchanged lines hidden (view full) ---

644}
645
646const struct dev_pm_ops zpa2326_pm_ops = {
647 SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
648 pm_runtime_force_resume)
649 SET_RUNTIME_PM_OPS(zpa2326_runtime_suspend, zpa2326_runtime_resume,
650 NULL)
651};
208
209/**
210 * zpa2326_enable_device() - Enable device, i.e. get out of low power mode.
211 * @indio_dev: The IIO device associated with the hardware to enable.
212 *
213 * Required to access complete register space and to perform any sampling
214 * or control operations.
215 *

--- 428 unchanged lines hidden (view full) ---

644}
645
646const struct dev_pm_ops zpa2326_pm_ops = {
647 SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
648 pm_runtime_force_resume)
649 SET_RUNTIME_PM_OPS(zpa2326_runtime_suspend, zpa2326_runtime_resume,
650 NULL)
651};
652EXPORT_SYMBOL_GPL(zpa2326_pm_ops);
652EXPORT_SYMBOL_NS_GPL(zpa2326_pm_ops, IIO_ZPA2326);
653
654/**
655 * zpa2326_resume() - Request the PM layer to power supply the device.
656 * @indio_dev: The IIO device associated with the sampling hardware.
657 *
658 * Return:
659 * < 0 - a negative error code meaning failure ;
660 * 0 - success, device has just been powered up ;

--- 1032 unchanged lines hidden (view full) ---

1693sleep:
1694 /* Put to sleep just in case power regulators are "dummy" ones. */
1695 zpa2326_sleep(indio_dev);
1696poweroff:
1697 zpa2326_power_off(indio_dev, priv);
1698
1699 return err;
1700}
653
654/**
655 * zpa2326_resume() - Request the PM layer to power supply the device.
656 * @indio_dev: The IIO device associated with the sampling hardware.
657 *
658 * Return:
659 * < 0 - a negative error code meaning failure ;
660 * 0 - success, device has just been powered up ;

--- 1032 unchanged lines hidden (view full) ---

1693sleep:
1694 /* Put to sleep just in case power regulators are "dummy" ones. */
1695 zpa2326_sleep(indio_dev);
1696poweroff:
1697 zpa2326_power_off(indio_dev, priv);
1698
1699 return err;
1700}
1701EXPORT_SYMBOL_GPL(zpa2326_probe);
1701EXPORT_SYMBOL_NS_GPL(zpa2326_probe, IIO_ZPA2326);
1702
1703void zpa2326_remove(const struct device *parent)
1704{
1705 struct iio_dev *indio_dev = dev_get_drvdata(parent);
1706
1707 iio_device_unregister(indio_dev);
1708 zpa2326_fini_runtime(indio_dev->dev.parent);
1709 zpa2326_sleep(indio_dev);
1710 zpa2326_power_off(indio_dev, iio_priv(indio_dev));
1711}
1702
1703void zpa2326_remove(const struct device *parent)
1704{
1705 struct iio_dev *indio_dev = dev_get_drvdata(parent);
1706
1707 iio_device_unregister(indio_dev);
1708 zpa2326_fini_runtime(indio_dev->dev.parent);
1709 zpa2326_sleep(indio_dev);
1710 zpa2326_power_off(indio_dev, iio_priv(indio_dev));
1711}
1712EXPORT_SYMBOL_GPL(zpa2326_remove);
1712EXPORT_SYMBOL_NS_GPL(zpa2326_remove, IIO_ZPA2326);
1713
1714MODULE_AUTHOR("Gregor Boirie <gregor.boirie@parrot.com>");
1715MODULE_DESCRIPTION("Core driver for Murata ZPA2326 pressure sensor");
1716MODULE_LICENSE("GPL v2");
1713
1714MODULE_AUTHOR("Gregor Boirie <gregor.boirie@parrot.com>");
1715MODULE_DESCRIPTION("Core driver for Murata ZPA2326 pressure sensor");
1716MODULE_LICENSE("GPL v2");