Lines Matching full:ec
3 * Expose a PWM controlled by the ChromeOS EC to the host processor.
16 * struct cros_ec_pwm_device - Driver data for EC PWM
19 * @ec: Pointer to EC device
24 struct cros_ec_device *ec; member
61 static int cros_ec_pwm_set_duty(struct cros_ec_device *ec, u8 index, u16 duty) in cros_ec_pwm_set_duty() argument
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, u8 index) in cros_ec_pwm_get_duty() argument
108 ret = cros_ec_cmd_xfer_status(ec, msg); in cros_ec_pwm_get_duty()
123 /* The EC won't let us change the period */ in cros_ec_pwm_apply()
128 * EC doesn't separate the concept of duty cycle and enabled, but in cros_ec_pwm_apply()
133 ret = cros_ec_pwm_set_duty(ec_pwm->ec, pwm->hwpwm, duty_cycle); in cros_ec_pwm_apply()
149 ret = cros_ec_pwm_get_duty(ec_pwm->ec, pwm->hwpwm); in cros_ec_pwm_get_state()
165 * will be 0 and the actual duty cycle read from the EC is used. in cros_ec_pwm_get_state()
185 /* The EC won't let us change the period */ in cros_ec_pwm_xlate()
200 * Determine the number of supported PWMs. The EC does not return the number
204 static int cros_ec_num_pwms(struct cros_ec_device *ec) in cros_ec_num_pwms() argument
210 ret = cros_ec_pwm_get_duty(ec, i); in cros_ec_num_pwms()
214 * The EC error codes map to -EOPNOTSUPP and -EINVAL, in cros_ec_num_pwms()
234 struct cros_ec_device *ec = dev_get_drvdata(pdev->dev.parent); in cros_ec_pwm_probe() local
240 if (!ec) { in cros_ec_pwm_probe()
241 dev_err(dev, "no parent EC device\n"); in cros_ec_pwm_probe()
249 ec_pwm->ec = ec; in cros_ec_pwm_probe()
257 ret = cros_ec_num_pwms(ec); in cros_ec_pwm_probe()
286 { .compatible = "google,cros-ec-pwm" },
296 .name = "cros-ec-pwm",
302 MODULE_ALIAS("platform:cros-ec-pwm");
303 MODULE_DESCRIPTION("ChromeOS EC PWM driver");