Lines Matching +full:ec +full:- +full:pwm
1 // SPDX-License-Identifier: GPL-2.0+
10 * Fan control is provided via pwm interface in the range [0-255].
11 * Old AMD boards use [0-100] as range in the EC, the written value is
13 * AOKZOE are not scaled but have the same EC layout. Newer models
14 * like the 2 and X1 are [0-184] and are scaled to 0-255. OrangePi
15 * are [1-244] and scaled to 0-255.
66 /* Fan reading and PWM */
69 #define OXP_SENSOR_PWM_ENABLE_REG 0x4A /* PWM enable is 1 register long */
70 #define OXP_SENSOR_PWM_REG 0x4B /* PWM reading is 1 register long */
74 /* OrangePi fan reading and PWM */
76 #define ORANGEPI_SENSOR_PWM_ENABLE_REG 0x40 /* PWM enable is 1 register long */
77 #define ORANGEPI_SENSOR_PWM_REG 0x38 /* PWM reading is 1 register long */
80 * Different boards have different values and EC registers
131 DMI_EXACT_MATCH(DMI_BOARD_NAME, "AB05-Mendocino"),
166 DMI_EXACT_MATCH(DMI_BOARD_NAME, "NEO-01"),
172 DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
179 DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
186 DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
193 DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
200 DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
207 DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
215 /* Helper functions to handle EC read/write */
223 return -EBUSY; in read_from_ec()
235 return -EBUSY; in read_from_ec()
245 return -EBUSY; in write_to_ec()
250 return -EBUSY; in write_to_ec()
278 return -EINVAL; in tt_toggle_enable()
305 return -EINVAL; in tt_toggle_disable()
321 return attr->mode; in tt_toggle_is_visible()
371 return -EINVAL; in tt_toggle_show()
383 /* PWM enable/disable functions */
405 return -EINVAL; in oxp_pwm_enable()
431 return -EINVAL; in oxp_pwm_disable()
494 /* scale from range [1-244] */ in oxp_platform_read()
495 *val = ((*val - 1) * 254 / 243) + 1; in oxp_platform_read()
502 /* scale from range [0-184] */ in oxp_platform_read()
518 /* scale from range [0-100] */ in oxp_platform_read()
562 return -EOPNOTSUPP; in oxp_platform_read()
576 return -EINVAL; in oxp_platform_write()
579 return -EINVAL; in oxp_platform_write()
582 /* scale to range [1-244] */ in oxp_platform_write()
583 val = ((val - 1) * 243 / 254) + 1; in oxp_platform_write()
587 /* scale to range [0-184] */ in oxp_platform_write()
600 /* scale to range [0-100] */ in oxp_platform_write()
618 return -EOPNOTSUPP; in oxp_platform_write()
621 /* Known sensors in the OXP EC controllers */
625 HWMON_CHANNEL_INFO(pwm,
659 struct device *dev = &pdev->dev; in oxp_platform_probe()
670 .name = "oxp-platform",
684 return -ENODEV; in oxp_platform_init()
686 board = (enum oxp_board)(unsigned long)dmi_entry->driver_data; in oxp_platform_init()
691 * to tell them apart is the CPU. Old Intel boards have an unsupported EC. in oxp_platform_init()
694 return -ENODEV; in oxp_platform_init()
715 MODULE_DESCRIPTION("Platform driver that handles EC sensors of OneXPlayer devices");