Lines Matching full:psu

83 	struct ibm_cffps *psu = file->private_data;  in ibm_cffps_debugfs_read_input_history()  local
86 .addr = psu->client->addr, in ibm_cffps_debugfs_read_input_history()
87 .flags = psu->client->flags, in ibm_cffps_debugfs_read_input_history()
91 .addr = psu->client->addr, in ibm_cffps_debugfs_read_input_history()
92 .flags = psu->client->flags | I2C_M_RD, in ibm_cffps_debugfs_read_input_history()
94 .buf = psu->input_history, in ibm_cffps_debugfs_read_input_history()
99 rc = pmbus_lock_interruptible(psu->client); in ibm_cffps_debugfs_read_input_history()
103 rc = pmbus_set_page(psu->client, 0, 0xff); in ibm_cffps_debugfs_read_input_history()
105 pmbus_unlock(psu->client); in ibm_cffps_debugfs_read_input_history()
113 rc = i2c_transfer(psu->client->adapter, msg, 2); in ibm_cffps_debugfs_read_input_history()
114 pmbus_unlock(psu->client); in ibm_cffps_debugfs_read_input_history()
120 psu->input_history + 1, in ibm_cffps_debugfs_read_input_history()
121 psu->input_history[0]); in ibm_cffps_debugfs_read_input_history()
136 struct ibm_cffps *psu = to_psu(idxp, idx); in ibm_cffps_debugfs_read() local
139 rc = pmbus_lock_interruptible(psu->client); in ibm_cffps_debugfs_read()
143 rc = pmbus_set_page(psu->client, 0, 0xff); in ibm_cffps_debugfs_read()
149 if (psu->version == cffps1) in ibm_cffps_debugfs_read()
150 rc = i2c_smbus_read_word_swapped(psu->client, PMBUS_MFR_POUT_MAX); in ibm_cffps_debugfs_read()
152 rc = i2c_smbus_read_word_data(psu->client, PMBUS_MFR_POUT_MAX); in ibm_cffps_debugfs_read()
157 rc = i2c_smbus_read_word_swapped(psu->client, CFFPS_CCIN_CMD); in ibm_cffps_debugfs_read()
162 switch (psu->version) { in ibm_cffps_debugfs_read()
165 rc = i2c_smbus_read_byte_data(psu->client, CFFPS_FW_CMD + i); in ibm_cffps_debugfs_read()
176 rc = i2c_smbus_read_word_data(psu->client, CFFPS_FW_CMD + i); in ibm_cffps_debugfs_read()
191 rc = i2c_smbus_read_byte_data(psu->client, PMBUS_ON_OFF_CONFIG); in ibm_cffps_debugfs_read()
201 pmbus_unlock(psu->client); in ibm_cffps_debugfs_read()
219 struct ibm_cffps *psu = to_psu(idxp, idx); in ibm_cffps_debugfs_write() local
227 rc = pmbus_lock_interruptible(psu->client); in ibm_cffps_debugfs_write()
231 rc = pmbus_set_page(psu->client, 0, 0xff); in ibm_cffps_debugfs_write()
233 pmbus_unlock(psu->client); in ibm_cffps_debugfs_write()
237 rc = i2c_smbus_write_byte_data(psu->client, PMBUS_ON_OFF_CONFIG, data); in ibm_cffps_debugfs_write()
238 pmbus_unlock(psu->client); in ibm_cffps_debugfs_write()
348 struct ibm_cffps *psu = container_of(led_cdev, struct ibm_cffps, led); in ibm_cffps_led_brightness_set() local
355 if (psu->led_state != CFFPS_LED_BLINK) in ibm_cffps_led_brightness_set()
361 dev_dbg(&psu->client->dev, "LED brightness set: %d. Command: %d.\n", in ibm_cffps_led_brightness_set()
364 rc = pmbus_lock_interruptible(psu->client); in ibm_cffps_led_brightness_set()
368 rc = pmbus_set_page(psu->client, 0, 0xff); in ibm_cffps_led_brightness_set()
370 pmbus_unlock(psu->client); in ibm_cffps_led_brightness_set()
374 rc = i2c_smbus_write_byte_data(psu->client, CFFPS_SYS_CONFIG_CMD, in ibm_cffps_led_brightness_set()
376 pmbus_unlock(psu->client); in ibm_cffps_led_brightness_set()
380 psu->led_state = next_led_state; in ibm_cffps_led_brightness_set()
391 struct ibm_cffps *psu = container_of(led_cdev, struct ibm_cffps, led); in ibm_cffps_led_blink_set() local
393 dev_dbg(&psu->client->dev, "LED blink set.\n"); in ibm_cffps_led_blink_set()
395 rc = pmbus_lock_interruptible(psu->client); in ibm_cffps_led_blink_set()
399 rc = pmbus_set_page(psu->client, 0, 0xff); in ibm_cffps_led_blink_set()
401 pmbus_unlock(psu->client); in ibm_cffps_led_blink_set()
405 rc = i2c_smbus_write_byte_data(psu->client, CFFPS_SYS_CONFIG_CMD, in ibm_cffps_led_blink_set()
407 pmbus_unlock(psu->client); in ibm_cffps_led_blink_set()
411 psu->led_state = CFFPS_LED_BLINK; in ibm_cffps_led_blink_set()
419 static void ibm_cffps_create_led_class(struct ibm_cffps *psu) in ibm_cffps_create_led_class() argument
422 struct i2c_client *client = psu->client; in ibm_cffps_create_led_class()
425 snprintf(psu->led_name, sizeof(psu->led_name), "%s-%02x", client->name, in ibm_cffps_create_led_class()
427 psu->led.name = psu->led_name; in ibm_cffps_create_led_class()
428 psu->led.max_brightness = LED_FULL; in ibm_cffps_create_led_class()
429 psu->led.brightness_set_blocking = ibm_cffps_led_brightness_set; in ibm_cffps_create_led_class()
430 psu->led.blink_set = ibm_cffps_led_blink_set; in ibm_cffps_create_led_class()
432 rc = devm_led_classdev_register(dev, &psu->led); in ibm_cffps_create_led_class()
487 struct ibm_cffps *psu; in ibm_cffps_probe() local
549 psu = devm_kzalloc(&client->dev, sizeof(*psu), GFP_KERNEL); in ibm_cffps_probe()
550 if (!psu) in ibm_cffps_probe()
553 psu->version = vs; in ibm_cffps_probe()
554 psu->client = client; in ibm_cffps_probe()
556 ibm_cffps_create_led_class(psu); in ibm_cffps_probe()
564 psu->debugfs_entries[i] = i; in ibm_cffps_probe()
566 debugfs_create_file("input_history", 0444, debugfs, psu, &ibm_cffps_input_history_fops); in ibm_cffps_probe()
568 &psu->debugfs_entries[CFFPS_DEBUGFS_MAX_POWER_OUT], in ibm_cffps_probe()
571 &psu->debugfs_entries[CFFPS_DEBUGFS_CCIN], in ibm_cffps_probe()
574 &psu->debugfs_entries[CFFPS_DEBUGFS_FW], in ibm_cffps_probe()
577 &psu->debugfs_entries[CFFPS_DEBUGFS_ON_OFF_CONFIG], in ibm_cffps_probe()