xref: /freebsd/sys/dev/dialog/da9063/da9063_if.m (revision 4d846d260e2b9a3d4d0a701462568268cbfe7a5b)
180466455SJessica Clarke#-
2*4d846d26SWarner Losh# SPDX-License-Identifier: BSD-2-Clause
380466455SJessica Clarke#
480466455SJessica Clarke# Copyright (c) 2022 Jessica Clarke <jrtc27@FreeBSD.org>
580466455SJessica Clarke#
680466455SJessica Clarke# Redistribution and use in source and binary forms, with or without
780466455SJessica Clarke# modification, are permitted provided that the following conditions
880466455SJessica Clarke# are met:
980466455SJessica Clarke# 1. Redistributions of source code must retain the above copyright
1080466455SJessica Clarke#    notice, this list of conditions and the following disclaimer.
1180466455SJessica Clarke# 2. Redistributions in binary form must reproduce the above copyright
1280466455SJessica Clarke#    notice, this list of conditions and the following disclaimer in the
1380466455SJessica Clarke#    documentation and/or other materials provided with the distribution.
1480466455SJessica Clarke#
1580466455SJessica Clarke# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1680466455SJessica Clarke# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1780466455SJessica Clarke# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1880466455SJessica Clarke# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1980466455SJessica Clarke# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2080466455SJessica Clarke# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2180466455SJessica Clarke# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2280466455SJessica Clarke# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2380466455SJessica Clarke# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2480466455SJessica Clarke# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2580466455SJessica Clarke# SUCH DAMAGE.
2680466455SJessica Clarke#
2780466455SJessica Clarke
2880466455SJessica Clarke#
2980466455SJessica Clarke# The Dialog Semiconductor DA9063 PMIC is a multi-function device that can be
3080466455SJessica Clarke# connected using both I2C and SPI. This provides a bus-independent interface
3180466455SJessica Clarke# to the underlying protocol-specific driver for the child devices.
3280466455SJessica Clarke#
3380466455SJessica ClarkeINTERFACE da9063;
3480466455SJessica Clarke
3580466455SJessica ClarkeMETHOD int read {
3680466455SJessica Clarke	device_t	dev;
3780466455SJessica Clarke	uint16_t	addr;
3880466455SJessica Clarke	uint8_t		*val;
3980466455SJessica Clarke};
4080466455SJessica Clarke
4180466455SJessica ClarkeMETHOD int write {
4280466455SJessica Clarke	device_t	dev;
4380466455SJessica Clarke	uint16_t	addr;
4480466455SJessica Clarke	uint8_t		val;
4580466455SJessica Clarke};
4680466455SJessica Clarke
4780466455SJessica ClarkeMETHOD int modify {
4880466455SJessica Clarke	device_t	dev;
4980466455SJessica Clarke	uint16_t	addr;
5080466455SJessica Clarke	uint8_t		clear_mask;
5180466455SJessica Clarke	uint8_t		set_mask;
5280466455SJessica Clarke};
53