-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathams_i2c.h
More file actions
75 lines (67 loc) · 2.36 KB
/
ams_i2c.h
File metadata and controls
75 lines (67 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
************************************************************************************
* Copyright (c) [2025] ams-OSRAM AG *
* *
* SPDX-License-Identifier: GPL-2.0 OR MIT *
* *
* For the full license texts, see LICENSES-GPL-2.0.txt or LICENSES-MIT.TXT. *
************************************************************************************
*/
#ifndef __AMS_I2C_H__
#define __AMS_I2C_H__
#include <linux/i2c.h>
/**
* i2c_read - Read number of bytes starting at a specific address over I2C
*
* @client: the i2c client
* @reg: the i2c register address
* @buf: pointer to a buffer that will contain the received data
* @len: number of bytes to read
*
* Returns 0 for no Error, else negative errno.
*/
int i2c_read(struct i2c_client *client, char reg, char *buf, int len);
/**
* i2c_write - Write number of bytes starting at a specific address over I2C
*
* @client: the i2c client
* @reg: the i2c register address
* @buf: pointer to a buffer that will contain the data to write
* @len: number of bytes to write
*
* Returns 0 for no Error, else negative errno.
*/
int i2c_write(struct i2c_client *client, char reg, const char *buf, int len);
/**
* i2c_write_mask - Write a byte to the specified address with a given bitmask
*
* @client: the i2c client
* @reg: the i2c register address
* @val: byte to write
* @mask: bitmask to apply to address before writing
*
* Returns 0 for no Error, else negative errno.
*/
int i2c_write_mask(struct i2c_client *client, char reg, char val, char mask);
/**
* i2c_get_register - Return a specific register
*
* @chip: sensor_chip pointer
* @client: the i2c client
* @reg: the i2c register address
* @value: pointer to value in register
*
* Returns 0 for no Error, else negative errno.
*/
int i2c_get_register(struct i2c_client *client, char reg, char *value);
/**
* i2c_set_register - Set a specific register
*
* @chip: sensor_chip pointer
* @client: the i2c client
* @reg: the i2c register address
* @value: value to set in register
* Returns 0 for no Error, else negative errno.
*/
int i2c_set_register(struct i2c_client *client, char reg, const char value);
#endif