blob: e4c190e68896e08cf0d2fb8182483442db4ea358 [file] [log] [blame]
David Collinsed930492013-01-23 13:57:09 -08001/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef _LINUX_BIF_CONSUMER_H_
14#define _LINUX_BIF_CONSUMER_H_
15
16#include <linux/bitops.h>
17#include <linux/kernel.h>
18#include <linux/notifier.h>
19
20#define BIF_DEVICE_ID_BYTE_LENGTH 8
21#define BIF_UNIQUE_ID_BYTE_LENGTH 10
22#define BIF_UNIQUE_ID_BIT_LENGTH 80
23
24#define BIF_PRIMARY_SLAVE_DEV_ADR 0x01
25
26/**
27 * enum bif_transaction - BIF master bus transaction types
28 * %BIF_TRANS_WD: Write data
29 * %BIF_TRANS_ERA: Extended register address
30 * %BIF_TRANS_WRA: Write register address
31 * %BIF_TRANS_RRA: Read register address
32 * %BIF_TRANS_BC: Bus command
33 * %BIF_TRANS_EDA: Extended device address
34 * %BIF_TRANS_SDA: Slave device address
35 *
36 * These values correspond to BIF word bits: BCF, bit 9, bit 8.
37 * BCF_n bit is inserted automatically.
38 */
39enum bif_transaction {
40 BIF_TRANS_WD = 0x00,
41 BIF_TRANS_ERA = 0x01,
42 BIF_TRANS_WRA = 0x02,
43 BIF_TRANS_RRA = 0x03,
44 BIF_TRANS_BC = 0x04,
45 BIF_TRANS_EDA = 0x05,
46 BIF_TRANS_SDA = 0x06,
47};
48
49/* BIF slave response components */
50#define BIF_SLAVE_RD_ACK 0x200
51#define BIF_SLAVE_RD_EOT 0x100
52#define BIF_SLAVE_RD_DATA 0x0FF
53#define BIF_SLAVE_RD_ERR 0x0FF
54#define BIF_SLAVE_TACK_ACK 0x200
55#define BIF_SLAVE_TACK_WCNT 0x0FF
56#define BIF_SLAVE_TACK_ERR 0x0FF
57
58/**
59 * enum bif_bus_command - MIPI defined bus commands to use in BC transaction
60 * %BIF_CMD_BRES: Bus reset of all slaves
61 * %BIF_CMD_PDWN: Put all slaves into power down mode
62 * %BIF_CMD_STBY: Put all slaves into standby mode
63 * %BIF_CMD_EINT: Enable interrupts for all slaves
64 * %BIF_CMD_ISTS: Poll interrupt status for all slaves. Expects BQ
65 * response if any slave has a pending interrupt.
66 * %BIF_CMD_RBL: Specify the burst read length for the next read
67 * transaction. Bits 3 to 0 should also be ORed on in
68 * order to specify the number of bytes to read.
69 * %BIF_CMD_RBE: Specify the extended burst read length for the next read
70 * transaction. Bits 3 to 0 should also be ORed on in
71 * order to specify the number of bytes to read. The burst
72 * read length for RBEy and RBLx = 16 * y + x.
73 * %BIF_CMD_DASM: Device activation stick mode. This keeps a slave
74 * selected if it would otherwise become unselected by the
75 * next transaction.
76 * %BIF_CMD_DISS: UID search start
77 * %BIF_CMD_DILC: UID length check. Expects BQ response if all 80 UID
78 * bits for a given slave have been entered.
79 * %BIF_CMD_DIE0: UID search enter 0
80 * %BIF_CMD_DIE1: UID search enter 1
81 * %BIF_CMD_DIP0: UID search probe 0
82 * %BIF_CMD_DIP1: UID search probe 1
83 * %BIF_CMD_DRES: Device reset of selected slaves
84 * %BIF_CMD_TQ: Transaction query; expects TACK response
85 * %BIF_CMD_AIO: Address increment off for the next transaction
86 *
87 * These values correspond to BIF word bits 7 to 0.
88 */
89enum bif_bus_command {
90 BIF_CMD_BRES = 0x00,
91 BIF_CMD_PDWN = 0x02,
92 BIF_CMD_STBY = 0x03,
93 BIF_CMD_EINT = 0x10,
94 BIF_CMD_ISTS = 0x11,
95 BIF_CMD_RBL = 0x20,
96 BIF_CMD_RBE = 0x30,
97 BIF_CMD_DASM = 0x40,
98 BIF_CMD_DISS = 0x80,
99 BIF_CMD_DILC = 0x81,
100 BIF_CMD_DIE0 = 0x84,
101 BIF_CMD_DIE1 = 0x85,
102 BIF_CMD_DIP0 = 0x86,
103 BIF_CMD_DIP1 = 0x87,
104 BIF_CMD_DRES = 0xC0,
105 BIF_CMD_TQ = 0xC2,
106 BIF_CMD_AIO = 0xC4,
107};
108
109/**
110 * struct bif_ddb_l1_data - MIPI defined L1 DDB data structure
111 * @revision: DDB version; should be 0x10 for DDB v1.0
112 * @level: DDB level support; should be 0x03 for DDB L1 and L2
113 * @device_class: MIPI device class; should be 0x0800
114 * @manufacturer_id: Manufacturer ID number allocated by MIPI
115 * @product_id: Manufacturer specified product ID number
116 * @length: Size of L2 function directory in bytes
117 */
118struct bif_ddb_l1_data {
119 u8 revision;
120 u8 level;
121 u16 device_class;
122 u16 manufacturer_id;
123 u16 product_id;
124 u16 length;
125};
126
127/**
128 * struct bif_ddb_l2_data - MIPI defined L2 DDB function data structure
129 * @function_type: Defines the type of the function. The type may be
130 * either MIPI or manufacturer defined.
131 * @function_version: Defines the version of the function. The version may
132 * be either MIPI or manufacturer defined.
133 * @function_pointer: Address in BIF slave memory where the register map for
134 * the function begins.
135 */
136struct bif_ddb_l2_data {
137 u8 function_type;
138 u8 function_version;
139 u16 function_pointer;
140};
141
142/**
143 * enum bif_mipi_function_type - MIPI defined DDB L2 function types
144 * %BIF_FUNC_PROTOCOL: Protocol function which provides access to core
145 * BIF communication features.
146 * %BIF_FUNC_SLAVE_CONTROL: Slave control function which provides control
147 * for BIF slave interrupts and tasks.
148 * %BIF_FUNC_TEMPERATURE: Temperature sensor function which provides a
149 * means to accurately read the battery temperature
150 * in a single-shot or periodic fashion.
151 * %BIF_FUNC_NVM: Non-volatile memory function which provides a
152 * means to store data onto a BIF slave that is
153 * non-volatile. Secondary slave objects are also
154 * found through the NVM function.
155 * %BIF_FUNC_AUTHENTICATION: Authentication function which provides a means
156 * to authenticate batteries. This function does
157 * not have a MIPI defined implimentation. Instead
158 * all aspects of the authentication function are
159 * left to the discretion of the manufacturer.
160 */
161enum bif_mipi_function_type {
162 BIF_FUNC_PROTOCOL = 0x01,
163 BIF_FUNC_SLAVE_CONTROL = 0x02,
164 BIF_FUNC_TEMPERATURE = 0x03,
165 BIF_FUNC_NVM = 0x04,
166 BIF_FUNC_AUTHENTICATION = 0x05,
167};
168
169#define BIF_DDB_L1_BASE_ADDR 0x0000
170#define BIF_DDB_L2_BASE_ADDR 0x000A
171
172/**
173 * enum bif_slave_error_code - MIPI defined BIF slave error codes
174 * %BIF_ERR_NONE: No error occurred
175 * %BIF_ERR_GENERAL: An unenumerated error occurred
176 * %BIF_ERR_PARITY: A Hamming-15 parity check failed for a word
177 * sent on the bus
178 * %BIF_ERR_INVERSION: More than 8 bits in a word were 1
179 * %BIF_ERR_BAD_LENGTH: Word had more or less than 17 bits
180 * %BIF_ERR_TIMING: Bit timing was violated in a word
181 * %BIF_ERR_UNKNOWN_CMD: Bus command was unknown to the slave
182 * %BIF_ERR_CMD_SEQ: Commands with ordering dependency were not
183 * sent in the right order
184 * %BIF_ERR_BUS_COLLISION: BCL was already low at the beginning of a new
185 * transaction
186 * %BIF_ERR_SLAVE_BUSY: Slave is busy and cannot respond
187 * %BIF_ERR_FATAL: Slave is in an unrecoverable error state and
188 * must be reset
189 *
190 * These values are present in the ERR portion of an RD or TACK slave response
191 * word. These values can also be found in the ERR_CODE register of the
192 * protocol function.
193 */
194enum bif_slave_error_code {
195 BIF_ERR_NONE = 0x00,
196 BIF_ERR_GENERAL = 0x10,
197 BIF_ERR_PARITY = 0x11,
198 BIF_ERR_INVERSION = 0x12,
199 BIF_ERR_BAD_LENGTH = 0x13,
200 BIF_ERR_TIMING = 0x14,
201 BIF_ERR_UNKNOWN_CMD = 0x15,
202 BIF_ERR_CMD_SEQ = 0x16,
203 BIF_ERR_BUS_COLLISION = 0x1F,
204 BIF_ERR_SLAVE_BUSY = 0x20,
205 BIF_ERR_FATAL = 0x7F,
206};
207
208/**
209 * struct bif_protocol_function - constant data present in protocol function
210 * @l2_entry: Pointer to protocol function L2 DDB data struct
211 * @protocol_pointer: BIF slave address where protocol registers begin
212 * @device_id_pointer: BIF slave address where device ID begins
213 * @device_id: The 8-byte unique device ID in MSB to LSB order
214 */
215struct bif_protocol_function {
216 struct bif_ddb_l2_data *l2_entry;
217 u16 protocol_pointer;
218 u16 device_id_pointer;
219 u8 device_id[BIF_DEVICE_ID_BYTE_LENGTH]; /* Unique ID */
220};
221
222#define PROTOCOL_FUNC_DEV_ADR_ADDR(protocol_pointer) ((protocol_pointer) + 0)
223#define PROTOCOL_FUNC_ERR_CODE_ADDR(protocol_pointer) ((protocol_pointer) + 2)
224#define PROTOCOL_FUNC_ERR_CNT_ADDR(protocol_pointer) ((protocol_pointer) + 3)
225#define PROTOCOL_FUNC_WORD_CNT_ADDR(protocol_pointer) ((protocol_pointer) + 4)
226
227/**
228 * struct bif_slave_control_function - constant data present in slave control
229 * function as well internal software state parameters
230 * @l2_entry: Pointer to slave control function L2 DDB data struct
231 * @slave_ctrl_pointer: BIF slave address where slave control registers begin
232 * @task_count: Number of tasks supported by the slave
233 * @irq_notifier_list: List of notifiers for consumers drivers that wish to be
234 * notified when any given interrupt triggers. This list
235 * is dynamically allocated with length task_count.
236 */
237struct bif_slave_control_function {
238 struct bif_ddb_l2_data *l2_entry;
239 u16 slave_ctrl_pointer;
240 unsigned int task_count;
241 struct blocking_notifier_head *irq_notifier_list;
242};
243
244#define SLAVE_CTRL_TASKS_PER_SET 8
245
246/**
247 * bif_slave_control_task_is_valid() - returns true if the specified task
248 * is supported by the slave or false if it isn't
249 * @func: Pointer to slave's slave control function structure
250 * @task: Slave task number to check
251 */
252static inline bool
253bif_slave_control_task_is_valid(struct bif_slave_control_function *func,
254 unsigned int task)
255{
256 return func ? task < func->task_count : false;
257}
258
259#define SLAVE_CTRL_FUNC_IRQ_EN_ADDR(slave_ctrl_pointer, task) \
260 ((slave_ctrl_pointer) + 4 * ((task) / SLAVE_CTRL_TASKS_PER_SET) + 0)
261
262#define SLAVE_CTRL_FUNC_IRQ_STATUS_ADDR(slave_ctrl_pointer, task) \
263 ((slave_ctrl_pointer) + 4 * ((task) / SLAVE_CTRL_TASKS_PER_SET) + 1)
264#define SLAVE_CTRL_FUNC_IRQ_CLEAR_ADDR(slave_ctrl_pointer, task) \
265 SLAVE_CTRL_FUNC_IRQ_STATUS_ADDR(slave_ctrl_pointer, task)
266
267#define SLAVE_CTRL_FUNC_TASK_TRIGGER_ADDR(slave_ctrl_pointer, task) \
268 ((slave_ctrl_pointer) + 4 * ((task) / SLAVE_CTRL_TASKS_PER_SET) + 2)
269#define SLAVE_CTRL_FUNC_TASK_BUSY_ADDR(slave_ctrl_pointer, task) \
270 SLAVE_CTRL_FUNC_TASK_TRIGGER_ADDR(slave_ctrl_pointer, task)
271
272#define SLAVE_CTRL_FUNC_TASK_AUTO_TRIGGER_ADDR(slave_ctrl_pointer, task) \
273 ((slave_ctrl_pointer) + 4 * ((task) / SLAVE_CTRL_TASKS_PER_SET) + 3)
274
275/**
276 * struct bif_temperature_function - constant data present in temperature
277 * sensor function
278 * @temperatuer_pointer: BIF slave address where temperature sensor
279 * control registers begin
280 * @slave_control_channel: Slave control channel associated with the
281 * temperature sensor function. This channel is
282 * also the task number.
283 * @accuracy_pointer: BIF slave address where temperature accuracy
284 * registers begin
285 */
286struct bif_temperature_function {
287 u16 temperature_pointer;
288 u8 slave_control_channel;
289 u16 accuracy_pointer;
290};
291
292/**
293 * enum bif_mipi_object_type - MIPI defined BIF object types
294 * %BIF_OBJ_END_OF_LIST: Indicates that the end of the object list in
295 * NVM has been reached
296 * %BIF_OBJ_SEC_SLAVE: Specifies the UIDs of secondary slaves found
297 * inside of the battery pack
298 * %BIF_OBJ_BATT_PARAM: Specifies some variety of battery parameter.
299 * There is no MIPI defined format for this object
300 * type so parsing is manufacturer specific.
301 */
302enum bif_mipi_object_type {
303 BIF_OBJ_END_OF_LIST = 0x00,
304 BIF_OBJ_SEC_SLAVE = 0x01,
305 BIF_OBJ_BATT_PARAM = 0x02,
306};
307
308/**
309 * struct bif_object - contains all header and data information for a slave
310 * data object
311 * @type: Object type
312 * @version: Object version
313 * @manufacturer_id: Manufacturer ID number allocated by MIPI
314 * @length: Length of the entire object including header and CRC
315 * @data: Raw byte data found in the object
316 * @crc: CRC of the object calculated using CRC-CCITT
317 * @list: Linked-list connection parameter
318 * @addr: BIF slave address correspond to the start of the object
319 *
320 * manufacturer_id == 0x0000 if MIPI type and version.
321 */
322struct bif_object {
323 u8 type;
324 u8 version;
325 u16 manufacturer_id;
326 u16 length;
327 u8 *data;
328 u16 crc;
329 struct list_head list;
330 u16 addr;
331};
332
333/**
334 * struct bif_nvm_function - constant data present in non-volatile memory
335 * function as well internal software state
336 * parameters
337 * @nvm_pointer: BIF slave address where NVM registers begin
338 * @slave_control_channel: Slave control channel associated with the
339 * NVM function. This channel is also the task
340 * number.
341 * @write_buffer_size: Size in bytes of the NVM write buffer. 0x00
342 * is used to denote a 256 byte buffer.
343 * @nvm_base_address: BIF slave address where NVM begins
344 * @nvm_size: NVM size in bytes
345 * @object_count: Number of BIF objects read from NVM
346 * @object_list: List of BIF objects read from NVM
347 */
348struct bif_nvm_function {
349 u16 nvm_pointer;
350 u8 slave_control_channel;
351 u8 write_buffer_size;
352 u16 nvm_base_address;
353 u16 nvm_size;
354 int object_count;
355 struct list_head object_list;
356};
357
358/**
359 * struct bif_ctrl - Opaque handle for a BIF controller to be used in bus
360 * oriented BIF function calls.
361 */
362struct bif_ctrl;
363
364/**
365 * struct bif_slave - Opaque handle for a BIF slave to be used in slave oriented
366 * BIF function calls.
367 */
368struct bif_slave;
369
370/**
371 * enum bif_bus_state - indicates the current or desired state of the BIF bus
372 * %BIF_BUS_STATE_MASTER_DISABLED: BIF host hardware is disabled
373 * %BIF_BUS_STATE_POWER_DOWN: BIF bus is in power down state and
374 * BCL is not being pulled high
375 * %BIF_BUS_STATE_STANDBY: BIF slaves are in standby state in which
376 * less power is drawn
377 * %BIF_BUS_STATE_ACTIVE: BIF slaves are ready for immediate
378 * communications
379 * %BIF_BUS_STATE_INTERRUPT: BIF bus is active, but no communication
380 * is possible. Instead, either one of the
381 * slaves or the master must transition to
382 * active state by pulling BCL low for 1
383 * tau bif period.
384 */
385enum bif_bus_state {
386 BIF_BUS_STATE_MASTER_DISABLED,
387 BIF_BUS_STATE_POWER_DOWN,
388 BIF_BUS_STATE_STANDBY,
389 BIF_BUS_STATE_ACTIVE,
390 BIF_BUS_STATE_INTERRUPT,
391};
392
393/**
394 * enum bif_bus_event - events that the BIF framework may send to BIF consumers
395 * %BIF_BUS_EVENT_BATTERY_INSERTED: Indicates that a battery was just
396 * inserted physically or that the BIF
397 * host controller for the battery just
398 * probed and a battery was already
399 * present.
400 * %BIF_BUS_EVENT_BATTERY_REMOVED: Indicates that a battery was just
401 * removed and thus its slaves are no
402 * longer accessible.
403 */
404enum bif_bus_event {
405 BIF_BUS_EVENT_BATTERY_INSERTED,
406 BIF_BUS_EVENT_BATTERY_REMOVED,
407};
408
409/* Mask values to be ORed together for use in bif_match_criteria.match_mask. */
410#define BIF_MATCH_MANUFACTURER_ID BIT(0)
411#define BIF_MATCH_PRODUCT_ID BIT(1)
412#define BIF_MATCH_FUNCTION_TYPE BIT(2)
413#define BIF_MATCH_FUNCTION_VERSION BIT(3)
414#define BIF_MATCH_IGNORE_PRESENCE BIT(4)
415
416/**
417 * struct bif_match_criteria - specifies the matching criteria that a BIF
418 * consumer uses to find an appropriate BIF slave
419 * @match_mask: Mask value specifying which parameters to match upon.
420 * This value should be some ORed combination of
421 * BIF_MATCH_* specified above.
422 * @manufacturer_id: Manufacturer ID number allocated by MIPI
423 * @product_id: Manufacturer specified product ID number
424 * @function_type: Defines the type of the function. The type may be
425 * either MIPI or manufacturer defined.
426 * @function_version: Defines the version of the function. The version may
427 * be either MIPI or manufacturer defined.
428 * @ignore_presence: If true, then slaves that are currently not present
429 * will be successfully matched against. By default, only
430 * present slaves can be matched.
431 */
432struct bif_match_criteria {
433 u32 match_mask;
434 u16 manufacturer_id;
435 u16 product_id;
436 u8 function_type;
437 u8 function_version;
438 bool ignore_presence;
439};
440
441/**
442 * bif_battery_rid_ranges - MIPI-BIF defined Rid battery pack resistance ranges
443 * %BIF_BATT_RID_SPECIAL1_MIN: Minimum Rid for special case 1
444 * %BIF_BATT_RID_SPECIAL1_MAX: Maximum Rid for special case 1
445 * %BIF_BATT_RID_SPECIAL2_MIN: Minimum Rid for special case 2
446 * %BIF_BATT_RID_SPECIAL2_MAX: Maximum Rid for special case 2
447 * %BIF_BATT_RID_SPECIAL3_MIN: Minimum Rid for special case 3
448 * %BIF_BATT_RID_SPECIAL3_MAX: Maximum Rid for special case 3
449 * %BIF_BATT_RID_LOW_COST_MIN: Minimum Rid for a low cost battery pack
450 * %BIF_BATT_RID_LOW_COST_MAX: Maximum Rid for a low cost battery pack
451 * %BIF_BATT_RID_SMART_MIN: Minimum Rid for a smart battery pack
452 * %BIF_BATT_RID_SMART_MAX: Maximum Rid for a smart battery pack
453 */
454enum bif_battery_rid_ranges {
455 BIF_BATT_RID_SPECIAL1_MIN = 0,
456 BIF_BATT_RID_SPECIAL1_MAX = 1,
457 BIF_BATT_RID_SPECIAL2_MIN = 7350,
458 BIF_BATT_RID_SPECIAL2_MAX = 7650,
459 BIF_BATT_RID_SPECIAL3_MIN = 12740,
460 BIF_BATT_RID_SPECIAL3_MAX = 13260,
461 BIF_BATT_RID_LOW_COST_MIN = 19600,
462 BIF_BATT_RID_LOW_COST_MAX = 140000,
463 BIF_BATT_RID_SMART_MIN = 240000,
464 BIF_BATT_RID_SMART_MAX = 450000,
465};
466
467#ifdef CONFIG_BIF
468
469int bif_request_irq(struct bif_slave *slave, unsigned int task,
470 struct notifier_block *nb);
471int bif_free_irq(struct bif_slave *slave, unsigned int task,
472 struct notifier_block *nb);
473
474int bif_trigger_task(struct bif_slave *slave, unsigned int task);
475int bif_task_is_busy(struct bif_slave *slave, unsigned int task);
476
477int bif_ctrl_count(void);
478struct bif_ctrl *bif_ctrl_get_by_id(unsigned int id);
479struct bif_ctrl *bif_ctrl_get(struct device *consumer_dev);
480void bif_ctrl_put(struct bif_ctrl *ctrl);
481
482int bif_ctrl_signal_battery_changed(struct bif_ctrl *ctrl);
483
484int bif_slave_match_count(const struct bif_ctrl *ctrl,
485 const struct bif_match_criteria *match_criteria);
486
487struct bif_slave *bif_slave_match_get(const struct bif_ctrl *ctrl,
488 unsigned int id, const struct bif_match_criteria *match_criteria);
489
490void bif_slave_put(struct bif_slave *slave);
491
492int bif_ctrl_notifier_register(struct bif_ctrl *ctrl,
493 struct notifier_block *nb);
494
495int bif_ctrl_notifier_unregister(struct bif_ctrl *ctrl,
496 struct notifier_block *nb);
497
498struct bif_ctrl *bif_get_ctrl_handle(struct bif_slave *slave);
499
500int bif_slave_find_function(struct bif_slave *slave, u8 function, u8 *version,
501 u16 *function_pointer);
502
503int bif_slave_read(struct bif_slave *slave, u16 addr, u8 *buf, int len);
504int bif_slave_write(struct bif_slave *slave, u16 addr, u8 *buf, int len);
505
506int bif_slave_is_present(struct bif_slave *slave);
507
508int bif_slave_is_selected(struct bif_slave *slave);
509int bif_slave_select(struct bif_slave *slave);
510
511int bif_ctrl_raw_transaction(struct bif_ctrl *ctrl, int transaction, u8 data);
512int bif_ctrl_raw_transaction_read(struct bif_ctrl *ctrl, int transaction,
513 u8 data, int *response);
514int bif_ctrl_raw_transaction_query(struct bif_ctrl *ctrl, int transaction,
515 u8 data, bool *query_response);
516
517void bif_ctrl_bus_lock(struct bif_ctrl *ctrl);
518void bif_ctrl_bus_unlock(struct bif_ctrl *ctrl);
519
520u16 bif_crc_ccitt(const u8 *buffer, unsigned int len);
521
522int bif_ctrl_measure_rid(struct bif_ctrl *ctrl);
523int bif_ctrl_get_bus_period(struct bif_ctrl *ctrl);
524int bif_ctrl_set_bus_period(struct bif_ctrl *ctrl, int period_ns);
525int bif_ctrl_get_bus_state(struct bif_ctrl *ctrl);
526int bif_ctrl_set_bus_state(struct bif_ctrl *ctrl, enum bif_bus_state state);
527
528#else
529
530static inline int bif_request_irq(struct bif_slave *slave, unsigned int task,
531 struct notifier_block *nb) { return -EPERM; }
532static inline int bif_free_irq(struct bif_slave *slave, unsigned int task,
533 struct notifier_block *nb) { return -EPERM; }
534
535static inline int bif_trigger_task(struct bif_slave *slave, unsigned int task)
536{ return -EPERM; }
537static inline int bif_task_is_busy(struct bif_slave *slave, unsigned int task)
538{ return -EPERM; }
539
540static inline int bif_ctrl_count(void) { return -EPERM; }
541static inline struct bif_ctrl *bif_ctrl_get_by_id(unsigned int id)
542{ return ERR_PTR(-EPERM); }
543struct bif_ctrl *bif_ctrl_get(struct device *consumer_dev)
544{ return ERR_PTR(-EPERM); }
545static inline void bif_ctrl_put(struct bif_ctrl *ctrl) { return; }
546
547int bif_ctrl_signal_battery_changed(struct bif_ctrl *ctrl) { return -EPERM; }
548
549static inline int bif_slave_match_count(const struct bif_ctrl *ctrl,
550 const struct bif_match_criteria *match_criteria)
551{ return -EPERM; }
552
553static inline struct bif_slave *bif_slave_match_get(const struct bif_ctrl *ctrl,
554 unsigned int id, const struct bif_match_criteria *match_criteria)
555{ return ERR_PTR(-EPERM); }
556
557static inline void bif_slave_put(struct bif_slave *slave) { return; }
558
559static inline int bif_ctrl_notifier_register(struct bif_ctrl *ctrl,
560 struct notifier_block *nb)
561{ return -EPERM; }
562
563static inline int bif_ctrl_notifier_unregister(struct bif_ctrl *ctrl,
564 struct notifier_block *nb)
565{ return -EPERM; }
566
567static inline struct bif_ctrl *bif_get_ctrl_handle(struct bif_slave *slave)
568{ return ERR_PTR(-EPERM); }
569
570static inline int bif_slave_find_function(struct bif_slave *slave, u8 function,
571 u8 *version, u16 *function_pointer)
572{ return -EPERM; }
573
574static inline int bif_slave_read(struct bif_slave *slave, u16 addr, u8 *buf,
575 int len)
576{ return -EPERM; }
577static inline int bif_slave_write(struct bif_slave *slave, u16 addr, u8 *buf,
578 int len)
579{ return -EPERM; }
580
581int bif_slave_is_present(struct bif_slave *slave) { return -EPERM; }
582
583int bif_slave_is_selected(struct bif_slave *slave) { return -EPERM; }
584int bif_slave_select(struct bif_slave *slave) { return -EPERM; }
585
586int bif_ctrl_raw_transaction(struct bif_ctrl *ctrl, int transaction, u8 data)
587{ return -EPERM; }
588int bif_ctrl_raw_transaction_read(struct bif_ctrl *ctrl, int transaction,
589 u8 data, int *response)
590{ return -EPERM; }
591int bif_ctrl_raw_transaction_query(struct bif_ctrl *ctrl, int transaction,
592 u8 data, bool *query_response)
593{ return -EPERM; }
594
595static inline void bif_ctrl_bus_lock(struct bif_ctrl *ctrl)
596{ return -EPERM; }
597static inline void bif_ctrl_bus_unlock(struct bif_ctrl *ctrl)
598{ return -EPERM; }
599
600static inline u16 bif_crc_ccitt(const u8 *buffer, unsigned int len)
601{ return 0; }
602
603static inline int bif_ctrl_measure_rid(struct bif_ctrl *ctrl) { return -EPERM; }
604int bif_ctrl_get_bus_period(struct bif_ctrl *ctrl) { return -EPERM; }
605int bif_ctrl_set_bus_period(struct bif_ctrl *ctrl, int period_ns)
606{ return -EPERM; }
607int bif_ctrl_get_bus_state(struct bif_ctrl *ctrl) { return -EPERM; }
608int bif_ctrl_set_bus_state(struct bif_ctrl *ctrl, enum bif_bus_state state)
609{ return -EPERM; }
610
611#endif
612
613#endif