Lines Matching full:ec
3 * Expose a PWM controlled by the ChromeOS EC to the host processor.
19 * struct cros_ec_pwm_device - Driver data for EC PWM
21 * @ec: Pointer to EC device
25 struct cros_ec_device *ec; member
51 struct cros_ec_device *ec = ec_pwm->ec; in cros_ec_pwm_set_duty() local
72 dev_err(ec->dev, "Invalid PWM type index: %d\n", index); in cros_ec_pwm_set_duty()
81 return cros_ec_cmd_xfer_status(ec, msg); in cros_ec_pwm_set_duty()
84 static int cros_ec_pwm_get_duty(struct cros_ec_device *ec, bool use_pwm_type, u8 index) in cros_ec_pwm_get_duty() argument
108 dev_err(ec->dev, "Invalid PWM type index: %d\n", index); in cros_ec_pwm_get_duty()
117 ret = cros_ec_cmd_xfer_status(ec, msg); in cros_ec_pwm_get_duty()
131 /* The EC won't let us change the period */ in cros_ec_pwm_apply()
139 * EC doesn't separate the concept of duty cycle and enabled, but in cros_ec_pwm_apply()
157 ret = cros_ec_pwm_get_duty(ec_pwm->ec, ec_pwm->use_pwm_type, pwm->hwpwm); in cros_ec_pwm_get_state()
177 * Determine the number of supported PWMs. The EC does not return the number
181 static int cros_ec_num_pwms(struct cros_ec_device *ec) in cros_ec_num_pwms() argument
191 ret = cros_ec_pwm_get_duty(ec, false, i); in cros_ec_num_pwms()
195 * The EC error codes map to -EOPNOTSUPP and -EINVAL, in cros_ec_num_pwms()
215 struct cros_ec_device *ec = dev_get_drvdata(pdev->dev.parent); in cros_ec_pwm_probe() local
224 if (!ec) in cros_ec_pwm_probe()
225 return dev_err_probe(dev, -EINVAL, "no parent EC device\n"); in cros_ec_pwm_probe()
227 if (of_device_is_compatible(np, "google,cros-ec-pwm-type")) { in cros_ec_pwm_probe()
231 ret = cros_ec_num_pwms(ec); in cros_ec_pwm_probe()
243 ec_pwm->ec = ec; in cros_ec_pwm_probe()
270 { .compatible = "google,cros-ec-pwm" },
271 { .compatible = "google,cros-ec-pwm-type" },
280 .name = "cros-ec-pwm",
286 MODULE_ALIAS("platform:cros-ec-pwm");
287 MODULE_DESCRIPTION("ChromeOS EC PWM driver");