linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Echtler <floe@butterbrot.org>
To: hverkuil@xs4all.nl, linux-media@vger.kernel.org
Cc: linux-input@vger.kernel.org, modin@yuri.at,
	Florian Echtler <floe@butterbrot.org>
Subject: [PATCH 5/5] add module parameters for default values
Date: Tue,  6 Feb 2018 22:01:45 +0100	[thread overview]
Message-ID: <1517950905-5015-6-git-send-email-floe@butterbrot.org> (raw)
In-Reply-To: <1517950905-5015-1-git-send-email-floe@butterbrot.org>

To allow setting custom parameters for the sensor directly at startup, the
three primary controls are exposed as module parameters in this patch.

Signed-off-by: Florian Echtler <floe@butterbrot.org>
---
 drivers/input/touchscreen/sur40.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c
index 66ef7e6..d1fcb95 100644
--- a/drivers/input/touchscreen/sur40.c
+++ b/drivers/input/touchscreen/sur40.c
@@ -167,6 +167,17 @@ struct sur40_image_header {
 #define SUR40_BACKLIGHT_MIN 0x00
 #define SUR40_BACKLIGHT_DEF 0x01
 
+/* module parameters */
+static uint brightness = SUR40_BRIGHTNESS_DEF;
+module_param(brightness, uint, 0644);
+MODULE_PARM_DESC(brightness, "set default brightness");
+static uint contrast = SUR40_CONTRAST_DEF;
+module_param(contrast, uint, 0644);
+MODULE_PARM_DESC(contrast, "set default contrast");
+static uint gain = SUR40_GAIN_DEF;
+module_param(gain, uint, 0644);
+MODULE_PARM_DESC(contrast, "set default gain");
+
 static const struct v4l2_pix_format sur40_pix_format[] = {
 	{
 		.pixelformat = V4L2_TCH_FMT_TU08,
@@ -374,6 +385,11 @@ static void sur40_open(struct input_polled_dev *polldev)
 
 	dev_dbg(sur40->dev, "open\n");
 	sur40_init(sur40);
+
+	/* set default values */
+	sur40_set_irlevel(sur40, brightness & 0xFF);
+	sur40_set_vsvideo(sur40, ((contrast & 0x0F) << 4) | (gain & 0x0F));
+	sur40_set_preprocessor(sur40, SUR40_BACKLIGHT_DEF);
 }
 
 /* Disable device, polling has stopped. */
-- 
2.7.4

  parent reply	other threads:[~2018-02-06 21:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-06 21:01 [PATCH v2] [RFC] add video controls for SUR40 driver Florian Echtler
2018-02-06 21:01 ` [PATCH 1/5] add missing blob structure field for tag id Florian Echtler
2018-02-06 21:22   ` Hans Verkuil
2018-02-07  8:24     ` Florian Echtler
2018-02-06 21:01 ` [PATCH 2/5] add control definitions Florian Echtler
2018-02-06 21:01 ` [PATCH 3/5] add panel register access functions Florian Echtler
2018-02-06 21:01 ` [PATCH 4/5] register control handlers using V4L2 control framework Florian Echtler
2018-02-06 21:26   ` Hans Verkuil
2018-02-06 21:01 ` Florian Echtler [this message]
2018-02-06 21:31   ` [PATCH 5/5] add module parameters for default values Hans Verkuil
2018-02-07  8:33     ` Florian Echtler
2018-02-07  9:02       ` Hans Verkuil

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=1517950905-5015-6-git-send-email-floe@butterbrot.org \
    --to=floe@butterbrot.org \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=modin@yuri.at \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).