summaryrefslogtreecommitdiff
path: root/drivers/misc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/cros_ec_sandbox.c47
-rw-r--r--drivers/misc/fs_loader.c3
-rw-r--r--drivers/misc/i2c_eeprom.c2
-rw-r--r--drivers/misc/misc-uclass.c2
-rw-r--r--drivers/misc/p2sb-uclass.c2
-rw-r--r--drivers/misc/pwrseq-uclass.c2
6 files changed, 58 insertions, 0 deletions
diff --git a/drivers/misc/cros_ec_sandbox.c b/drivers/misc/cros_ec_sandbox.c
index bc01df0904e..db5e3b0f51a 100644
--- a/drivers/misc/cros_ec_sandbox.c
+++ b/drivers/misc/cros_ec_sandbox.c
@@ -64,6 +64,7 @@ struct ec_keymatrix_entry {
enum {
VSTORE_SLOT_COUNT = 4,
+ PWM_CHANNEL_COUNT = 4,
};
struct vstore_slot {
@@ -71,6 +72,10 @@ struct vstore_slot {
u8 data[EC_VSTORE_SLOT_SIZE];
};
+struct ec_pwm_channel {
+ uint duty; /* not ns, EC_PWM_MAX_DUTY = 100% */
+};
+
/**
* struct ec_state - Information about the EC state
*
@@ -85,6 +90,7 @@ struct vstore_slot {
* @recovery_req: Keyboard recovery requested
* @test_flags: Flags that control behaviour for tests
* @slot_locked: Locked vstore slots (mask)
+ * @pwm: Information per PWM channel
*/
struct ec_state {
u8 vbnv_context[EC_VBNV_BLOCK_SIZE_V2];
@@ -98,6 +104,7 @@ struct ec_state {
bool recovery_req;
uint test_flags;
struct vstore_slot slot[VSTORE_SLOT_COUNT];
+ struct ec_pwm_channel pwm[PWM_CHANNEL_COUNT];
} s_state, *g_state;
/**
@@ -554,6 +561,33 @@ static int process_cmd(struct ec_state *ec,
len = sizeof(*resp);
break;
}
+ case EC_CMD_PWM_GET_DUTY: {
+ const struct ec_params_pwm_get_duty *req = req_data;
+ struct ec_response_pwm_get_duty *resp = resp_data;
+ struct ec_pwm_channel *pwm;
+
+ if (req->pwm_type != EC_PWM_TYPE_GENERIC)
+ return -EINVAL;
+ if (req->index >= PWM_CHANNEL_COUNT)
+ return -EINVAL;
+ pwm = &ec->pwm[req->index];
+ resp->duty = pwm->duty;
+ len = sizeof(*resp);
+ break;
+ }
+ case EC_CMD_PWM_SET_DUTY: {
+ const struct ec_params_pwm_set_duty *req = req_data;
+ struct ec_pwm_channel *pwm;
+
+ if (req->pwm_type != EC_PWM_TYPE_GENERIC)
+ return -EINVAL;
+ if (req->index >= PWM_CHANNEL_COUNT)
+ return -EINVAL;
+ pwm = &ec->pwm[req->index];
+ pwm->duty = req->duty;
+ len = 0;
+ break;
+ }
default:
printf(" ** Unknown EC command %#02x\n", req_hdr->command);
return -1;
@@ -619,6 +653,19 @@ void sandbox_cros_ec_set_test_flags(struct udevice *dev, uint flags)
ec->test_flags = flags;
}
+int sandbox_cros_ec_get_pwm_duty(struct udevice *dev, uint index, uint *duty)
+{
+ struct ec_state *ec = dev_get_priv(dev);
+ struct ec_pwm_channel *pwm;
+
+ if (index >= PWM_CHANNEL_COUNT)
+ return -ENOSPC;
+ pwm = &ec->pwm[index];
+ *duty = pwm->duty;
+
+ return 0;
+}
+
int cros_ec_probe(struct udevice *dev)
{
struct ec_state *ec = dev_get_priv(dev);
diff --git a/drivers/misc/fs_loader.c b/drivers/misc/fs_loader.c
index e77b3af770e..0139bd66ba7 100644
--- a/drivers/misc/fs_loader.c
+++ b/drivers/misc/fs_loader.c
@@ -3,6 +3,9 @@
* Copyright (C) 2018-2019 Intel Corporation <www.intel.com>
*
*/
+
+#define LOG_CATEGORY UCLASS_FS_FIRMWARE_LOADER
+
#include <common.h>
#include <dm.h>
#include <env.h>
diff --git a/drivers/misc/i2c_eeprom.c b/drivers/misc/i2c_eeprom.c
index 5926c91a2ec..3b249842f8b 100644
--- a/drivers/misc/i2c_eeprom.c
+++ b/drivers/misc/i2c_eeprom.c
@@ -3,6 +3,8 @@
* Copyright (c) 2014 Google, Inc
*/
+#define LOG_CATEGORY UCLASS_I2C_EEPROM
+
#include <common.h>
#include <eeprom.h>
#include <linux/delay.h>
diff --git a/drivers/misc/misc-uclass.c b/drivers/misc/misc-uclass.c
index 55381edc980..72720b0e590 100644
--- a/drivers/misc/misc-uclass.c
+++ b/drivers/misc/misc-uclass.c
@@ -3,6 +3,8 @@
* Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
*/
+#define LOG_CATEGORY UCLASS_MISC
+
#include <common.h>
#include <dm.h>
#include <errno.h>
diff --git a/drivers/misc/p2sb-uclass.c b/drivers/misc/p2sb-uclass.c
index ac2852559f5..94d273de9b3 100644
--- a/drivers/misc/p2sb-uclass.c
+++ b/drivers/misc/p2sb-uclass.c
@@ -6,6 +6,8 @@
* Written by Simon Glass <sjg@chromium.org>
*/
+#define LOG_CATEGORY UCLASS_P2SB
+
#include <common.h>
#include <dm.h>
#include <log.h>
diff --git a/drivers/misc/pwrseq-uclass.c b/drivers/misc/pwrseq-uclass.c
index c8f6c46069b..a0f24e1bf3a 100644
--- a/drivers/misc/pwrseq-uclass.c
+++ b/drivers/misc/pwrseq-uclass.c
@@ -3,6 +3,8 @@
* Copyright (c) 2015 Google, Inc
*/
+#define LOG_CATEGORY UCLASS_PWRSEQ
+
#include <common.h>
#include <dm.h>
#include <pwrseq.h>