Merge "disp: msm: dsi: Implement dsi parser u64_read function"
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
commit
f471be45f9
@@ -1,5 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
@@ -552,7 +553,45 @@ int dsi_parser_read_string(const struct device_node *np,
|
||||
int dsi_parser_read_u64(const struct device_node *np, const char *propname,
|
||||
u64 *out_value)
|
||||
{
|
||||
return -EINVAL;
|
||||
struct dsi_parser_node *node = (struct dsi_parser_node *)np;
|
||||
struct dsi_parser_prop *prop;
|
||||
char *property, *to_int, item[SZ_128];
|
||||
int rc = 0, base;
|
||||
|
||||
prop = dsi_parser_search_property(node, propname);
|
||||
if (!prop) {
|
||||
DSI_DEBUG("%s not found\n", propname);
|
||||
rc = -EINVAL;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!prop->value) {
|
||||
DSI_ERR("%s prop value not found\n", propname);
|
||||
rc = -ENODATA;
|
||||
goto end;
|
||||
}
|
||||
|
||||
strscpy(item, prop->value, SZ_128);
|
||||
property = item;
|
||||
to_int = strsep(&property, "x");
|
||||
|
||||
if (!property) {
|
||||
property = to_int;
|
||||
base = 10;
|
||||
} else {
|
||||
base = 16;
|
||||
}
|
||||
|
||||
rc = kstrtou64(property, base, out_value);
|
||||
if (rc) {
|
||||
DSI_ERR("prop=%s error(%d) converting %s, base=%d\n",
|
||||
propname, rc, property, base);
|
||||
goto end;
|
||||
}
|
||||
|
||||
DSI_DEBUG("%s=%d\n", propname, *out_value);
|
||||
end:
|
||||
return rc;
|
||||
}
|
||||
|
||||
int dsi_parser_read_u32(const struct device_node *np,
|
||||
|
||||
Reference in New Issue
Block a user