Lines Matching +full:in +full:- +full:application
1 // SPDX-License-Identifier: GPL-2.0-only
23 /* Error-Status codes returned in mailbox read command */
33 /* GPIO Application */
37 /* Sleep/Wake application */
43 /* AFE application */
48 /* Reset/Suspend/Clear application */
50 #define MMA9551_RSC_OFFSET(mask) (3 - (ffs(mask) - 1) / 8)
51 #define MMA9551_RSC_VAL(mask) (mask >> (((ffs(mask) - 1) / 8) * 8))
55 * - control registers: MB0-3
56 * - data registers: MB4-31
59 * - mbox to write to (always 0)
60 * - control registers: MB1-4
61 * - data registers: MB5-31
77 * Bits 6-4: command
78 * Bits 3-0: upper bits of register offset
83 u8 buf[MMA9551_MAX_MAILBOX_DATA_REGS - 1];
92 * Bits 6-0: Error code.
115 struct i2c_msg in, out; in mma9551_transfer() local
120 dev_err(&client->dev, "register offset too large\n"); in mma9551_transfer()
121 return -EINVAL; in mma9551_transfer()
137 out.addr = client->addr; in mma9551_transfer()
142 ret = i2c_transfer(client->adapter, &out, 1); in mma9551_transfer()
144 dev_err(&client->dev, "i2c write failed\n"); in mma9551_transfer()
152 in.addr = client->addr; in mma9551_transfer()
153 in.flags = I2C_M_RD; in mma9551_transfer()
154 in.len = sizeof(rsp); in mma9551_transfer()
155 in.buf = (u8 *)&rsp; in mma9551_transfer()
157 ret = i2c_transfer(client->adapter, &in, 1); in mma9551_transfer()
159 dev_err(&client->dev, "i2c read failed\n"); in mma9551_transfer()
165 } while (--retries > 0); in mma9551_transfer()
168 dev_err(&client->dev, in mma9551_transfer()
170 return -ETIMEDOUT; in mma9551_transfer()
174 dev_err(&client->dev, in mma9551_transfer()
175 "app_id mismatch in response got %02x expected %02x\n", in mma9551_transfer()
177 return -EINVAL; in mma9551_transfer()
182 dev_err(&client->dev, "read returned error %x\n", err_code); in mma9551_transfer()
183 return -EINVAL; in mma9551_transfer()
187 dev_err(&client->dev, in mma9551_transfer()
190 return -EINVAL; in mma9551_transfer()
200 * mma9551_read_config_byte() - read 1 configuration byte
202 * @app_id: Application ID
203 * @reg: Application register
225 * mma9551_write_config_byte() - write 1 configuration byte
227 * @app_id: Application ID
228 * @reg: Application register
250 * mma9551_read_status_byte() - read 1 status byte
252 * @app_id: Application ID
253 * @reg: Application register
275 * mma9551_read_config_word() - read 1 config word
277 * @app_id: Application ID
278 * @reg: Application register
309 * mma9551_write_config_word() - write 1 config word
311 * @app_id: Application ID
312 * @reg: Application register
336 * mma9551_read_status_word() - read 1 status word
338 * @app_id: Application ID
339 * @reg: Application register
370 * mma9551_read_config_words() - read multiple config words
372 * @app_id: Application ID
373 * @reg: Application register
374 * @len: Length of array to read (in words)
377 * Read multiple configuration registers (word-sized registers).
392 dev_err(&client->dev, "Invalid buffer size %d\n", len); in mma9551_read_config_words()
393 return -EINVAL; in mma9551_read_config_words()
409 * mma9551_read_status_words() - read multiple status words
411 * @app_id: Application ID
412 * @reg: Application register
413 * @len: Length of array to read (in words)
416 * Read multiple status registers (word-sized registers).
431 dev_err(&client->dev, "Invalid buffer size %d\n", len); in mma9551_read_status_words()
432 return -EINVAL; in mma9551_read_status_words()
448 * mma9551_write_config_words() - write multiple config words
450 * @app_id: Application ID
451 * @reg: Application register
452 * @len: Length of array to write (in words)
455 * Write multiple configuration registers (word-sized registers).
467 __be16 be_buf[(MMA9551_MAX_MAILBOX_DATA_REGS - 1) / 2]; in mma9551_write_config_words()
470 dev_err(&client->dev, "Invalid buffer size %d\n", len); in mma9551_write_config_words()
471 return -EINVAL; in mma9551_write_config_words()
483 * mma9551_update_config_bits() - update bits in register
485 * @app_id: Application ID
486 * @reg: Application register
490 * Update bits in the given register using a bit mask.
519 * mma9551_gpio_config() - configure gpio
522 * @app_id: Application ID
524 * @polarity: The polarity parameter is described in section 6.2.2, page 66,
529 * Assign a bit from an application’s status register to a specific GPIO pin.
544 dev_err(&client->dev, "bad GPIO pin\n"); in mma9551_gpio_config()
545 return -EINVAL; in mma9551_gpio_config()
557 dev_err(&client->dev, "error setting GPIO app_id\n"); in mma9551_gpio_config()
564 dev_err(&client->dev, "error setting GPIO bit number\n"); in mma9551_gpio_config()
591 dev_err(&client->dev, "error setting GPIO polarity\n"); in mma9551_gpio_config()
598 * mma9551_read_version() - read device version information
619 dev_info(&client->dev, "device ID 0x%x, firmware version %02x.%02x\n", in mma9551_read_version()
628 * mma9551_set_device_state() - sets HW power mode
633 * Set power on/off for device using the Sleep/Wake Application.
635 * When enable is false, enter sleep mode (device remains in the
636 * lowest-power mode).
658 * mma9551_set_power_state() - sets runtime PM state
673 ret = pm_runtime_resume_and_get(&client->dev); in mma9551_set_power_state()
675 pm_runtime_mark_last_busy(&client->dev); in mma9551_set_power_state()
676 ret = pm_runtime_put_autosuspend(&client->dev); in mma9551_set_power_state()
680 dev_err(&client->dev, in mma9551_set_power_state()
692 * mma9551_sleep() - sleep
693 * @freq: Application frequency
696 * device. Sleep for one application cycle to make sure the
697 * application had time to run once and initialize set values.
711 * mma9551_read_accel_chan() - read accelerometer channel
733 switch (chan->channel2) { in mma9551_read_accel_chan()
744 return -EINVAL; in mma9551_read_accel_chan()
767 * mma9551_read_accel_scale() - read accelerometer scale
785 * mma9551_app_reset() - reset application
787 * @app_mask: Application to reset
789 * Reset the given application (using the Reset/Suspend/Clear
790 * Control Application)