18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* Copyright (C) 2010 Google, Inc. 38c2ecf20Sopenharmony_ci * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 48c2ecf20Sopenharmony_ci * Author: Dima Zavin <dima@android.com> 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#ifndef _LINUX_SSBI_H 88c2ecf20Sopenharmony_ci#define _LINUX_SSBI_H 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include <linux/types.h> 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ciint ssbi_write(struct device *dev, u16 addr, const u8 *buf, int len); 138c2ecf20Sopenharmony_ciint ssbi_read(struct device *dev, u16 addr, u8 *buf, int len); 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_cistatic inline int 168c2ecf20Sopenharmony_cissbi_reg_read(void *context, unsigned int reg, unsigned int *val) 178c2ecf20Sopenharmony_ci{ 188c2ecf20Sopenharmony_ci int ret; 198c2ecf20Sopenharmony_ci u8 v; 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci ret = ssbi_read(context, reg, &v, 1); 228c2ecf20Sopenharmony_ci if (!ret) 238c2ecf20Sopenharmony_ci *val = v; 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci return ret; 268c2ecf20Sopenharmony_ci} 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_cistatic inline int 298c2ecf20Sopenharmony_cissbi_reg_write(void *context, unsigned int reg, unsigned int val) 308c2ecf20Sopenharmony_ci{ 318c2ecf20Sopenharmony_ci u8 v = val; 328c2ecf20Sopenharmony_ci return ssbi_write(context, reg, &v, 1); 338c2ecf20Sopenharmony_ci} 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci#endif 36