spmi: msm: correct len part in formatted cmd value.
When the bytes count required by SPMI clients is 8, read and write fail. This was observed when PMIC MPPs initialized. Fix this by adding bytes count restore in cmd formation as read and write process. Change-Id: I56dbbc0b8e99727c29ddae568ce6f17195888b4a Signed-off-by: Yimin Peng <yiminp@codeaurora.org>
This commit is contained in:
parent
07ec991ea1
commit
2c6e820516
1 changed files with 4 additions and 3 deletions
|
@ -183,7 +183,7 @@ static int vspmi_pmic_arb_read_cmd(struct spmi_controller *ctrl, u8 opc, u8 sid,
|
|||
{
|
||||
struct vspmi_pmic_arb *pa = spmi_controller_get_drvdata(ctrl);
|
||||
unsigned long flags;
|
||||
u8 bc = len;
|
||||
u8 bc = len - 1;
|
||||
u32 cmd;
|
||||
int rc;
|
||||
|
||||
|
@ -228,7 +228,7 @@ static int vspmi_pmic_arb_write_cmd(struct spmi_controller *ctrl, u8 opc,
|
|||
{
|
||||
struct vspmi_pmic_arb *pa = spmi_controller_get_drvdata(ctrl);
|
||||
unsigned long flags;
|
||||
u8 bc = len;
|
||||
u8 bc = len - 1;
|
||||
u32 cmd;
|
||||
int rc;
|
||||
|
||||
|
@ -270,7 +270,8 @@ static int vspmi_pmic_arb_write_cmd(struct spmi_controller *ctrl, u8 opc,
|
|||
|
||||
static u32 vspmi_pmic_arb_fmt_cmd_v1(u8 opc, u8 sid, u16 addr, u8 bc)
|
||||
{
|
||||
return (opc << 27) | ((sid & 0xf) << 20) | (addr << 4) | (bc & 0x7);
|
||||
return (opc << 27) | ((sid & 0xf) << 20) | (addr << 4) |
|
||||
((bc & 0x7) + 1);
|
||||
}
|
||||
|
||||
static const struct vspmi_backend_driver_ver_ops pmic_arb_v1 = {
|
||||
|
|
Loading…
Add table
Reference in a new issue