Thomas Gleixner | 97fb5e8 | 2019-05-29 07:17:58 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Kenneth Heitke | e44b0ce | 2013-03-12 11:41:46 -0700 | [diff] [blame] | 2 | /* Copyright (C) 2010 Google, Inc. |
| 3 | * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 4 | * Author: Dima Zavin <dima@android.com> |
Kenneth Heitke | e44b0ce | 2013-03-12 11:41:46 -0700 | [diff] [blame] | 5 | */ |
| 6 | |
David Brown | ce44bf5 | 2013-03-12 11:41:54 -0700 | [diff] [blame] | 7 | #ifndef _LINUX_SSBI_H |
| 8 | #define _LINUX_SSBI_H |
Kenneth Heitke | e44b0ce | 2013-03-12 11:41:46 -0700 | [diff] [blame] | 9 | |
| 10 | #include <linux/types.h> |
| 11 | |
Stephen Boyd | 5eec14c | 2013-12-10 15:35:17 -0800 | [diff] [blame] | 12 | int ssbi_write(struct device *dev, u16 addr, const u8 *buf, int len); |
David Brown | ce44bf5 | 2013-03-12 11:41:54 -0700 | [diff] [blame] | 13 | int ssbi_read(struct device *dev, u16 addr, u8 *buf, int len); |
Stephen Boyd | bae911a | 2013-12-10 15:35:16 -0800 | [diff] [blame] | 14 | |
Stephen Boyd | 559c04f | 2014-02-26 10:59:22 -0800 | [diff] [blame] | 15 | static inline int |
| 16 | ssbi_reg_read(void *context, unsigned int reg, unsigned int *val) |
| 17 | { |
| 18 | int ret; |
| 19 | u8 v; |
| 20 | |
| 21 | ret = ssbi_read(context, reg, &v, 1); |
| 22 | if (!ret) |
| 23 | *val = v; |
| 24 | |
| 25 | return ret; |
| 26 | } |
| 27 | |
| 28 | static inline int |
| 29 | ssbi_reg_write(void *context, unsigned int reg, unsigned int val) |
| 30 | { |
| 31 | u8 v = val; |
| 32 | return ssbi_write(context, reg, &v, 1); |
| 33 | } |
| 34 | |
Kenneth Heitke | e44b0ce | 2013-03-12 11:41:46 -0700 | [diff] [blame] | 35 | #endif |