All of lore.kernel.org
 help / color / mirror / Atom feed
From: AceLan Kao <acelan.kao@canonical.com>
To: Jiri Kosina <jikos@kernel.org>,
	Jonathan Cameron <jic23@kernel.org>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	linux-input@vger.kernel.org, linux-iio@vger.kernel.org
Subject: Display got wrong rotation after hid_sensor_accel_3d is loaded
Date: Thu, 26 Dec 2019 17:22:18 +0800	[thread overview]
Message-ID: <CAFv23QmiDdhe+xJw2y7CXiWq4-GK1S-1bcKxEpNhNJu3ZtzA_w@mail.gmail.com> (raw)

Hi all,

I'm working on a new platform which comes with an accelerator meter.
It's a STMicroelectronics LSM6DS3US accelerator meter, it doesn't use
st_sensors driver, but hid_sensor_accel_3d.
After hid_sensor_accel_3d is loaded, the display becomes upside down,
so I tried to add some code to make it become normal.(ACCEL_X should
have the same modification)

I don't know how to fix this in a correct way, please give me some hints.
Thanks.

diff --git a/drivers/iio/accel/hid-sensor-accel-3d.c
b/drivers/iio/accel/hid-sensor-accel-3d.c
index 24573eb647a3..8ca6a222b773 100644
--- a/drivers/iio/accel/hid-sensor-accel-3d.c
+++ b/drivers/iio/accel/hid-sensor-accel-3d.c
@@ -270,6 +270,8 @@ static int accel_3d_capture_sample(struct
hid_sensor_hub_device *hsdev,
               accel_state->accel_val[CHANNEL_SCAN_INDEX_X + offset] =
                                               *(u32 *)raw_data;
+               if (usage_id == HID_USAGE_SENSOR_ACCEL_Y_AXIS)
+                       accel_state->accel_val[CHANNEL_SCAN_INDEX_Y] *= -1;

Best regards,
AceLan Kao.

             reply	other threads:[~2019-12-26  9:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-26  9:22 AceLan Kao [this message]
2019-12-26 15:03 ` Display got wrong rotation after hid_sensor_accel_3d is loaded Bastien Nocera
2019-12-27  2:30   ` AceLan Kao
2019-12-30 17:18     ` Srinivas Pandruvada
2020-01-02  2:46       ` AceLan Kao
2020-01-02 17:43         ` Srinivas Pandruvada
2020-01-06  1:53           ` AceLan Kao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFv23QmiDdhe+xJw2y7CXiWq4-GK1S-1bcKxEpNhNJu3ZtzA_w@mail.gmail.com \
    --to=acelan.kao@canonical.com \
    --cc=jic23@kernel.org \
    --cc=jikos@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=srinivas.pandruvada@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.