/linux/drivers/acpi/ |
H A D | ec.c | 3 * ec.c - ACPI Embedded Controller Driver (v3) 17 #define pr_fmt(fmt) "ACPI: EC: " fmt 40 /* EC status register */ 45 #define ACPI_EC_FLAG_SCI 0x20 /* EC-SCI occurred */ 49 * This leads to lots of practical timing issues for the host EC driver. 50 * The following variations are defined (from the target EC firmware's 59 * kind of EC firmware has implemented an event queue and will 79 /* EC commands */ 88 #define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */ 90 #define ACPI_EC_UDELAY_POLL 550 /* Wait 1ms for EC transaction polling */ [all …]
|
/linux/drivers/md/ |
H A D | dm-ebs-target.c | 37 static inline sector_t __sector_to_block(struct ebs_c *ec, sector_t sector) in __sector_to_block() argument 39 return sector >> ec->block_shift; in __sector_to_block() 48 static inline unsigned int __nr_blocks(struct ebs_c *ec, struct bio *bio) in __nr_blocks() argument 50 sector_t end_sector = __block_mod(bio->bi_iter.bi_sector, ec->u_bs) + bio_sectors(bio); in __nr_blocks() 52 return __sector_to_block(ec, end_sector) + (__block_mod(end_sector, ec->u_bs) ? 1 : 0); in __nr_blocks() 65 static int __ebs_rw_bvec(struct ebs_c *ec, enum req_op op, struct bio_vec *bv, in __ebs_rw_bvec() argument 72 unsigned int buf_off = to_bytes(__block_mod(iter->bi_sector, ec->u_bs)); in __ebs_rw_bvec() 73 sector_t block = __sector_to_block(ec, iter->bi_sector); in __ebs_rw_bvec() 83 cur_len = min(dm_bufio_get_block_size(ec->bufio) - buf_off, bv_len); in __ebs_rw_bvec() 86 if (op == REQ_OP_READ || buf_off || bv_len < dm_bufio_get_block_size(ec->bufio)) in __ebs_rw_bvec() [all …]
|
/linux/drivers/platform/arm64/ |
H A D | lenovo-yoga-c630.c | 38 static int yoga_c630_ec_request(struct yoga_c630_ec *ec, u8 *req, size_t req_len, in yoga_c630_ec_request() argument 43 lockdep_assert_held(&ec->lock); in yoga_c630_ec_request() 45 ret = i2c_smbus_write_i2c_block_data(ec->client, LENOVO_EC_REQUEST_REG, in yoga_c630_ec_request() 50 return i2c_smbus_read_i2c_block_data(ec->client, LENOVO_EC_RESPONSE_REG, in yoga_c630_ec_request() 54 int yoga_c630_ec_read8(struct yoga_c630_ec *ec, u8 addr) in yoga_c630_ec_read8() argument 60 guard(mutex)(&ec->lock); in yoga_c630_ec_read8() 63 ret = yoga_c630_ec_request(ec, req, sizeof(req), &val, 1); in yoga_c630_ec_read8() 71 int yoga_c630_ec_read16(struct yoga_c630_ec *ec, u8 addr) in yoga_c630_ec_read16() argument 82 guard(mutex)(&ec->lock); in yoga_c630_ec_read16() 85 ret = yoga_c630_ec_request(ec, req, sizeof(req), &lsb, 1); in yoga_c630_ec_read16() [all …]
|
H A D | huawei-gaokun-ec.c | 3 * huawei-gaokun-ec - An EC driver for HUAWEI Matebook E Go 19 #include <linux/platform_data/huawei-gaokun-ec.h> 118 struct mutex lock; /* EC transaction lock */ 125 static int gaokun_ec_request(struct gaokun_ec *ec, const u8 *req, in gaokun_ec_request() argument 128 struct i2c_client *client = ec->client; in gaokun_ec_request() 144 guard(mutex)(&ec->lock); in gaokun_ec_request() 153 dev_err(&client->dev, "EC transaction error %d\n", ret); in gaokun_ec_request() 165 * gaokun_ec_read - Read from EC 166 * @ec: The gaokun_ec structure 171 * This function is used to read data after writing a magic sequence to EC. [all …]
|
/linux/drivers/platform/olpc/ |
H A D | olpc-ec.c | 19 #include <linux/olpc-ec.h> 42 /* Pending EC commands */ 49 * EC event mask to be applied during suspend (defining wakeup 55 * Running an EC command while suspending means we don't always finish 56 * the command before the machine suspends. This means that the EC 58 * of time (while the OS is asleep) the EC times out and restarts its 61 * the EC... and everyone's uphappy. 79 struct olpc_ec_priv *ec = container_of(w, struct olpc_ec_priv, worker); in olpc_ec_worker() local 84 spin_lock_irqsave(&ec->cmd_q_lock, flags); in olpc_ec_worker() 85 if (!list_empty(&ec->cmd_q)) { in olpc_ec_worker() [all …]
|
/linux/drivers/platform/chrome/wilco_ec/ |
H A D | mailbox.c | 7 * The Wilco EC is similar to a typical ChromeOS embedded controller. 9 * protocol, but with some important differences. The EC firmware does 21 #include <linux/platform_data/wilco-ec.h> 32 /* Version of EC protocol */ 41 /* EC response flags */ 43 #define EC_CMDR_PENDING BIT(1) /* Write pending to EC */ 44 #define EC_CMDR_BUSY BIT(2) /* EC is busy processing a command */ 48 * wilco_ec_response_timed_out() - Wait for EC response. 49 * @ec: EC device. 51 * Return: true if EC timed out, false if EC did not time out. [all …]
|
H A D | keyboard_leds.c | 7 * Since the EC will never change the backlight level of its own accord, 14 #include <linux/platform_data/wilco-ec.h> 22 struct wilco_ec_device *ec; member 33 * struct wilco_keyboard_leds_msg - Message to/from EC for keyboard LED control. 35 * @status: Set by EC to 0 on success, 0xFF on failure. 55 static int send_kbbl_msg(struct wilco_ec_device *ec, in send_kbbl_msg() argument 69 ret = wilco_ec_mailbox(ec, &msg); in send_kbbl_msg() 71 dev_err(ec->dev, in send_kbbl_msg() 79 static int set_kbbl(struct wilco_ec_device *ec, enum led_brightness brightness) in set_kbbl() argument 91 ret = send_kbbl_msg(ec, &request, &response); in set_kbbl() [all …]
|
H A D | sysfs.c | 5 * Sysfs properties to view and modify EC-controlled features on Wilco devices. 8 * See Documentation/ABI/testing/sysfs-platform-wilco-ec for more information. 13 #include <linux/platform_data/wilco-ec.h> 46 u8 status; /* Set by EC to 0 on success, other value on failure */ 47 u8 val; /* When getting, set by EC to either 0 or 1 */ 73 struct wilco_ec_device *ec = dev_get_drvdata(dev); in boot_on_ac_store() local 94 ret = wilco_ec_mailbox(ec, &msg); in boot_on_ac_store() 105 struct wilco_ec_device *ec = dev_get_drvdata(dev); in get_info() local 118 ret = wilco_ec_mailbox(ec, &msg); in get_info() 157 static int send_usb_charge(struct wilco_ec_device *ec, in send_usb_charge() argument [all …]
|
/linux/drivers/platform/chrome/ |
H A D | cros_ec_sensorhub.c | 21 #define DRV_NAME "cros-ec-sensorhub" 57 struct cros_ec_dev *ec = sensorhub->ec; in cros_ec_sensorhub_register() local 72 ret = cros_ec_cmd_xfer_status(ec->ec_dev, msg); in cros_ec_sensorhub_register() 74 /* The EC is still busy initializing sensors. */ in cros_ec_sensorhub_register() 81 dev_err(dev, "no info for EC sensor %d : %d/%d\n", in cros_ec_sensorhub_register() 92 name = "cros-ec-accel"; in cros_ec_sensorhub_register() 95 name = "cros-ec-baro"; in cros_ec_sensorhub_register() 98 name = "cros-ec-gyro"; in cros_ec_sensorhub_register() 101 name = "cros-ec-mag"; in cros_ec_sensorhub_register() 104 name = "cros-ec-prox"; in cros_ec_sensorhub_register() [all …]
|
H A D | cros_ec_debugfs.c | 2 // Debug logs for the ChromeOS EC 21 #define DRV_NAME "cros-ec-debugfs" 31 MODULE_PARM_DESC(log_poll_period_ms, "EC log polling period(ms)"); 37 * struct cros_ec_debugfs - EC debugging information. 39 * @ec: EC device this debugfs information belongs to 42 * @read_msg: preallocated EC command and buffer to read console log 44 * @log_poll_work: recurring task to poll EC for new console log data 47 * when EC panic 50 struct cros_ec_dev *ec; member 52 /* EC log */ [all …]
|
H A D | Kconfig | 81 Controller (EC) providing keyboard, battery and power services. 83 protocol for talking to the EC is defined by the bus driver. 94 EC through an I2C bus. This uses a simple byte-level protocol with 102 If you say Y here, you get support for talking to the ChromeOS EC 104 checksum. Also since there's no addition EC-to-host interrupt, this 115 If you say Y here, you get support for talking to the ChromeOS EC 128 If you say Y here, you get support for talking to the ChromeOS EC 129 through a SPI bus, using a byte-level protocol. Since the EC's 137 If you say Y here, you get support for talking to the ChromeOS EC 148 If you say Y here, you get support for talking to the ChromeOS EC [all …]
|
/linux/include/linux/platform_data/ |
H A D | wilco-ec.h | 15 #define WILCO_EC_FLAG_NO_RESPONSE BIT(0) /* EC does not respond */ 31 * @data_buffer: Buffer used for EC communication. The same buffer 33 * @data_size: Size of the data buffer used for EC communication. 75 * @result: Result code from the EC. Non-zero indicates an error. 91 * @WILCO_EC_MSG_LEGACY: Legacy EC messages for standard EC behavior. 92 * @WILCO_EC_MSG_PROPERTY: Get/Set/Sync EC controlled NVRAM property. 93 * @WILCO_EC_MSG_TELEMETRY: Request telemetry data from the EC. 105 * @request_size: Number of bytes to send to the EC. 107 * @response_size: Number of bytes to read from EC. 121 * wilco_ec_mailbox() - Send request to the EC and receive the response. [all …]
|
/linux/Documentation/ABI/testing/ |
H A D | debugfs-cros-ec | 1 What: /sys/kernel/debug/<cros-ec-device>/console_log 5 If the EC supports the CONSOLE_READ command type, this file 6 can be used to grab the EC logs. The kernel polls for the log 10 What: /sys/kernel/debug/<cros-ec-device>/panicinfo 14 This file dumps the EC panic information from the previous 16 type is supported by the EC. 18 What: /sys/kernel/debug/<cros-ec-device>/pdinfo 27 What: /sys/kernel/debug/<cros-ec-device>/uptime 31 A u32 providing the time since EC booted in ms. This is 32 is used for synchronizing the AP host time with the EC [all …]
|
/linux/drivers/ata/ |
H A D | pata_icside.c | 64 struct expansion_card *ec; member 83 /* Prototype: pata_icside_irqenable_arcin_v5 (struct expansion_card *ec, int irqnr) 86 static void pata_icside_irqenable_arcin_v5 (struct expansion_card *ec, int irqnr) in pata_icside_irqenable_arcin_v5() argument 88 struct pata_icside_state *state = ec->irq_data; in pata_icside_irqenable_arcin_v5() 93 /* Prototype: pata_icside_irqdisable_arcin_v5 (struct expansion_card *ec, int irqnr) 96 static void pata_icside_irqdisable_arcin_v5 (struct expansion_card *ec, int irqnr) in pata_icside_irqdisable_arcin_v5() argument 98 struct pata_icside_state *state = ec->irq_data; in pata_icside_irqdisable_arcin_v5() 110 /* Prototype: pata_icside_irqenable_arcin_v6 (struct expansion_card *ec, int irqnr) 113 static void pata_icside_irqenable_arcin_v6 (struct expansion_card *ec, int irqnr) in pata_icside_irqenable_arcin_v6() argument 115 struct pata_icside_state *state = ec->irq_data; in pata_icside_irqenable_arcin_v6() [all …]
|
/linux/drivers/mfd/ |
H A D | ntxec.c | 150 struct ntxec *ec; in ntxec_probe() local 156 ec = devm_kmalloc(&client->dev, sizeof(*ec), GFP_KERNEL); in ntxec_probe() 157 if (!ec) in ntxec_probe() 160 ec->dev = &client->dev; in ntxec_probe() 162 ec->regmap = devm_regmap_init_i2c(client, ®map_config); in ntxec_probe() 163 if (IS_ERR(ec->regmap)) { in ntxec_probe() 164 dev_err(ec->dev, "Failed to set up regmap for device\n"); in ntxec_probe() 165 return PTR_ERR(ec->regmap); in ntxec_probe() 169 res = regmap_read(ec->regmap, NTXEC_REG_VERSION, &version); in ntxec_probe() 171 dev_err(ec->dev, "Failed to read firmware version number\n"); in ntxec_probe() [all …]
|
/linux/drivers/scsi/arm/ |
H A D | powertec.c | 62 struct expansion_card *ec; member 68 /* Prototype: void powertecscsi_irqenable(ec, irqnr) 70 * Params : ec - expansion card structure 74 powertecscsi_irqenable(struct expansion_card *ec, int irqnr) in powertecscsi_irqenable() argument 76 struct powertec_info *info = ec->irq_data; in powertecscsi_irqenable() 80 /* Prototype: void powertecscsi_irqdisable(ec, irqnr) 82 * Params : ec - expansion card structure 86 powertecscsi_irqdisable(struct expansion_card *ec, int irqnr) in powertecscsi_irqdisable() argument 88 struct powertec_info *info = ec->irq_data; in powertecscsi_irqdisable() 193 host->hostt->name, info->info.scsi.type, info->ec->slot_no, in powertecscsi_info() [all …]
|
H A D | eesox.c | 74 struct expansion_card *ec; member 81 /* Prototype: void eesoxscsi_irqenable(ec, irqnr) 83 * Params : ec - expansion card structure 87 eesoxscsi_irqenable(struct expansion_card *ec, int irqnr) in eesoxscsi_irqenable() argument 89 struct eesoxscsi_info *info = (struct eesoxscsi_info *)ec->irq_data; in eesoxscsi_irqenable() 96 /* Prototype: void eesoxscsi_irqdisable(ec, irqnr) 98 * Params : ec - expansion card structure 102 eesoxscsi_irqdisable(struct expansion_card *ec, int irqnr) in eesoxscsi_irqdisable() argument 104 struct eesoxscsi_info *info = (struct eesoxscsi_info *)ec->irq_data; in eesoxscsi_irqdisable() 390 host->hostt->name, info->info.scsi.type, info->ec->slot_no, in eesoxscsi_info() [all …]
|
H A D | cumana_2.c | 79 struct expansion_card *ec; member 88 /* Prototype: void cumanascsi_2_irqenable(ec, irqnr) 90 * Params : ec - expansion card structure 94 cumanascsi_2_irqenable(struct expansion_card *ec, int irqnr) in cumanascsi_2_irqenable() argument 96 struct cumanascsi2_info *info = ec->irq_data; in cumanascsi_2_irqenable() 100 /* Prototype: void cumanascsi_2_irqdisable(ec, irqnr) 102 * Params : ec - expansion card structure 106 cumanascsi_2_irqdisable(struct expansion_card *ec, int irqnr) in cumanascsi_2_irqdisable() argument 108 struct cumanascsi2_info *info = ec->irq_data; in cumanascsi_2_irqdisable() 305 host->hostt->name, info->info.scsi.type, info->ec->slot_no, in cumanascsi_2_info() [all …]
|
/linux/drivers/iio/proximity/ |
H A D | cros_ec_mkbp_proximity.c | 3 * Driver for cros-ec proximity sensor exposed through MKBP switch 27 struct cros_ec_device *ec; member 98 struct cros_ec_device *ec = data->ec; in cros_ec_mkbp_proximity_push_event() local 103 timestamp = ktime_to_ns(ec->last_event_time); in cros_ec_mkbp_proximity_push_event() 122 struct cros_ec_device *ec = _ec; in cros_ec_mkbp_proximity_notify() local 123 u8 event_type = ec->event_data.event_type & EC_MKBP_EVENT_TYPE_MASK; in cros_ec_mkbp_proximity_notify() 131 switches = &ec->event_data.data.switches; in cros_ec_mkbp_proximity_notify() 144 struct cros_ec_device *ec = data->ec; in cros_ec_mkbp_proximity_read_raw() local 147 return cros_ec_mkbp_proximity_query(ec, val); in cros_ec_mkbp_proximity_read_raw() 185 struct cros_ec_device *ec = data->ec; in cros_ec_mkbp_proximity_resume() local [all …]
|
/linux/arch/x86/platform/olpc/ |
H A D | olpc.c | 3 * Support for the OLPC DCON and OLPC EC access 19 #include <linux/olpc-ec.h> 32 /* the timeout that bugs in the EC might force us to actually use */ 39 printk(KERN_ERR "olpc-ec: invalid argument to " in olpc_ec_timeout_set() 42 printk(KERN_DEBUG "olpc-ec: using %d ms delay for EC commands.\n", in olpc_ec_timeout_set() 75 printk(KERN_WARNING "olpc-ec: %d: waited %u ms for IBF!\n", in __wait_on_ibf() 95 printk(KERN_WARNING "olpc-ec: %d: waited %u ms for OBF!\n", in __wait_on_obf() 103 * This allows the kernel to run Embedded Controller commands. The EC is 105 * available EC commands are here: 107 * OpenFirmware's source is available, the EC's is not. [all …]
|
/linux/drivers/i2c/busses/ |
H A D | i2c-cros-ec-tunnel.c | 2 // Expose an I2C passthrough to the ChromeOS EC. 21 * @ec: Pointer to EC device 22 * @remote_bus: The EC bus number we tunnel to on the other side. 30 struct cros_ec_device *ec; member 61 * ec_i2c_construct_message - construct a message to go to the EC 64 * a format that the EC understands. 129 * ec_i2c_parse_response - Parse a response from the EC 131 * We'll take the EC's response and copy it back into msgs. 206 dev_err(dev, "Error constructing EC i2c message %d\n", result); in ec_i2c_xfer() 215 result = cros_ec_cmd_xfer_status(bus->ec, msg); in ec_i2c_xfer() [all …]
|
/linux/drivers/power/supply/ |
H A D | lenovo_yoga_c630_battery.c | 20 struct yoga_c630_ec *ec; member 73 struct yoga_c630_ec *ec = ecbat->ec; in yoga_c630_psy_update_bat_info() local 78 val = yoga_c630_ec_read8(ec, LENOVO_EC_BAT_PRESENT); in yoga_c630_psy_update_bat_info() 85 val = yoga_c630_ec_read8(ec, LENOVO_EC_BAT_ATTRIBUTES); in yoga_c630_psy_update_bat_info() 90 val = yoga_c630_ec_read16(ec, LENOVO_EC_BAT_DESIGN_CAPACITY); in yoga_c630_psy_update_bat_info() 96 * DSDT has delays after most of EC reads in these methods. in yoga_c630_psy_update_bat_info() 97 * Having no documentation for the EC we have to follow and sleep here. in yoga_c630_psy_update_bat_info() 101 val = yoga_c630_ec_read16(ec, LENOVO_EC_BAT_DESIGN_VOLTAGE); in yoga_c630_psy_update_bat_info() 108 val = yoga_c630_ec_read8(ec, LENOVO_EC_BAT_FULL_REGISTER); in yoga_c630_psy_update_bat_info() 111 val = yoga_c630_ec_read16(ec, in yoga_c630_psy_update_bat_info() [all …]
|
H A D | wilco-charger.c | 3 * Charging control driver for the Wilco EC 14 #include <linux/platform_data/wilco-ec.h> 19 /* Property IDs and related EC constants */ 38 /* Convert from POWER_SUPPLY_PROP_CHARGE_TYPE value to the EC's charge mode */ 59 /* Convert from EC's charge mode to POWER_SUPPLY_PROP_CHARGE_TYPE value */ 90 struct wilco_ec_device *ec = power_supply_get_drvdata(psy); in wilco_charge_get_property() local 109 ret = wilco_ec_get_byte_property(ec, property_id, &raw); in wilco_charge_get_property() 127 struct wilco_ec_device *ec = power_supply_get_drvdata(psy); in wilco_charge_set_property() local 135 return wilco_ec_set_byte_property(ec, PID_CHARGE_MODE, mode); in wilco_charge_set_property() 140 return wilco_ec_set_byte_property(ec, PID_CHARGE_LOWER_LIMIT, in wilco_charge_set_property() [all …]
|
/linux/drivers/iio/common/cros_ec_sensors/ |
H A D | cros_ec_sensors_core.c | 3 * cros_ec_sensors_core - Common function for Chrome OS EC sensor driver. 29 * Hard coded to the first device to support sensor fifo. The EC has a 2048 107 /* EC rate is in ms. */ in cros_ec_sensor_set_report_latency() 247 struct cros_ec_dev *ec = sensor_hub->ec; in cros_ec_sensors_core_init() local 255 state->ec = ec->ec_dev; in cros_ec_sensors_core_init() 258 state->ec->max_response), GFP_KERNEL); in cros_ec_sensors_core_init() 266 ret = cros_ec_get_host_cmd_version_mask(state->ec, in cros_ec_sensors_core_init() 267 ec->cmd_offset, in cros_ec_sensors_core_init() 275 state->msg->command = EC_CMD_MOTION_SENSE_CMD + ec->cmd_offset; in cros_ec_sensors_core_init() 329 if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE_FIFO)) { in cros_ec_sensors_core_init() [all …]
|
/linux/Documentation/devicetree/bindings/extcon/ |
H A D | extcon-usbc-cros-ec.yaml | 4 $id: http://devicetree.org/schemas/extcon/extcon-usbc-cros-ec.yaml# 7 title: ChromeOS EC USB Type-C cable and accessories detection 16 The node for this device must be under a cros-ec node like google,cros-ec-spi 17 or google,cros-ec-i2c. 21 const: google,extcon-usbc-cros-ec 40 cros-ec@0 { 41 compatible = "google,cros-ec-spi"; 46 compatible = "google,extcon-usbc-cros-ec"; 51 compatible = "google,extcon-usbc-cros-ec";
|