blob: 61007afba0cc806051737180ef07d9cc8f898974 [file] [log] [blame]
Thomas Gleixner97fb5e82019-05-29 07:17:58 -07001/* SPDX-License-Identifier: GPL-2.0-only */
Kenneth Heitkee44b0ce2013-03-12 11:41:46 -07002/* Copyright (C) 2010 Google, Inc.
3 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
4 * Author: Dima Zavin <dima@android.com>
Kenneth Heitkee44b0ce2013-03-12 11:41:46 -07005 */
6
David Brownce44bf52013-03-12 11:41:54 -07007#ifndef _LINUX_SSBI_H
8#define _LINUX_SSBI_H
Kenneth Heitkee44b0ce2013-03-12 11:41:46 -07009
10#include <linux/types.h>
11
Stephen Boyd5eec14c2013-12-10 15:35:17 -080012int ssbi_write(struct device *dev, u16 addr, const u8 *buf, int len);
David Brownce44bf52013-03-12 11:41:54 -070013int ssbi_read(struct device *dev, u16 addr, u8 *buf, int len);
Stephen Boydbae911a2013-12-10 15:35:16 -080014
Stephen Boyd559c04f2014-02-26 10:59:22 -080015static inline int
16ssbi_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
28static inline int
29ssbi_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 Heitkee44b0ce2013-03-12 11:41:46 -070035#endif