Commit 2c652a98 authored by Stephen Boyd's avatar Stephen Boyd Committed by Mark Brown

regulator: qcom_smd: Handle big endian CPUs

The smd rpm structures are always in little endian, but this
driver is not capable of being used on big endian CPUs. Annotate
the little endian data members and update the code to do the
proper byte swapping.
Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent f5164b88
...@@ -36,9 +36,9 @@ struct qcom_rpm_reg { ...@@ -36,9 +36,9 @@ struct qcom_rpm_reg {
}; };
struct rpm_regulator_req { struct rpm_regulator_req {
u32 key; __le32 key;
u32 nbytes; __le32 nbytes;
u32 value; __le32 value;
}; };
#define RPM_KEY_SWEN 0x6e657773 /* "swen" */ #define RPM_KEY_SWEN 0x6e657773 /* "swen" */
...@@ -62,9 +62,9 @@ static int rpm_reg_enable(struct regulator_dev *rdev) ...@@ -62,9 +62,9 @@ static int rpm_reg_enable(struct regulator_dev *rdev)
struct rpm_regulator_req req; struct rpm_regulator_req req;
int ret; int ret;
req.key = RPM_KEY_SWEN; req.key = cpu_to_le32(RPM_KEY_SWEN);
req.nbytes = sizeof(u32); req.nbytes = cpu_to_le32(sizeof(u32));
req.value = 1; req.value = cpu_to_le32(1);
ret = rpm_reg_write_active(vreg, &req, sizeof(req)); ret = rpm_reg_write_active(vreg, &req, sizeof(req));
if (!ret) if (!ret)
...@@ -86,8 +86,8 @@ static int rpm_reg_disable(struct regulator_dev *rdev) ...@@ -86,8 +86,8 @@ static int rpm_reg_disable(struct regulator_dev *rdev)
struct rpm_regulator_req req; struct rpm_regulator_req req;
int ret; int ret;
req.key = RPM_KEY_SWEN; req.key = cpu_to_le32(RPM_KEY_SWEN);
req.nbytes = sizeof(u32); req.nbytes = cpu_to_le32(sizeof(u32));
req.value = 0; req.value = 0;
ret = rpm_reg_write_active(vreg, &req, sizeof(req)); ret = rpm_reg_write_active(vreg, &req, sizeof(req));
...@@ -113,9 +113,9 @@ static int rpm_reg_set_voltage(struct regulator_dev *rdev, ...@@ -113,9 +113,9 @@ static int rpm_reg_set_voltage(struct regulator_dev *rdev,
struct rpm_regulator_req req; struct rpm_regulator_req req;
int ret = 0; int ret = 0;
req.key = RPM_KEY_UV; req.key = cpu_to_le32(RPM_KEY_UV);
req.nbytes = sizeof(u32); req.nbytes = cpu_to_le32(sizeof(u32));
req.value = min_uV; req.value = cpu_to_le32(min_uV);
ret = rpm_reg_write_active(vreg, &req, sizeof(req)); ret = rpm_reg_write_active(vreg, &req, sizeof(req));
if (!ret) if (!ret)
...@@ -129,9 +129,9 @@ static int rpm_reg_set_load(struct regulator_dev *rdev, int load_uA) ...@@ -129,9 +129,9 @@ static int rpm_reg_set_load(struct regulator_dev *rdev, int load_uA)
struct qcom_rpm_reg *vreg = rdev_get_drvdata(rdev); struct qcom_rpm_reg *vreg = rdev_get_drvdata(rdev);
struct rpm_regulator_req req; struct rpm_regulator_req req;
req.key = RPM_KEY_MA; req.key = cpu_to_le32(RPM_KEY_MA);
req.nbytes = sizeof(u32); req.nbytes = cpu_to_le32(sizeof(u32));
req.value = load_uA; req.value = cpu_to_le32(load_uA);
return rpm_reg_write_active(vreg, &req, sizeof(req)); return rpm_reg_write_active(vreg, &req, sizeof(req));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment