From patchwork Tue Feb 6 21:01:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Echtler X-Patchwork-Id: 10204103 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 706C160327 for ; Tue, 6 Feb 2018 21:02:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 679AC206AC for ; Tue, 6 Feb 2018 21:02:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C41228B0C; Tue, 6 Feb 2018 21:02:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FBEB206AC for ; Tue, 6 Feb 2018 21:02:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754061AbeBFVCJ (ORCPT ); Tue, 6 Feb 2018 16:02:09 -0500 Received: from butterbrot.org ([176.9.106.16]:59792 "EHLO butterbrot.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754049AbeBFVB6 (ORCPT ); Tue, 6 Feb 2018 16:01:58 -0500 Received: from flunder.fritz.box (unknown [95.90.181.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by butterbrot.org (Postfix) with ESMTPSA id 3C4FB4AE01F4; Tue, 6 Feb 2018 22:01:57 +0100 (CET) From: Florian Echtler To: hverkuil@xs4all.nl, linux-media@vger.kernel.org Cc: linux-input@vger.kernel.org, modin@yuri.at, Florian Echtler Subject: [PATCH 5/5] add module parameters for default values Date: Tue, 6 Feb 2018 22:01:45 +0100 Message-Id: <1517950905-5015-6-git-send-email-floe@butterbrot.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517950905-5015-1-git-send-email-floe@butterbrot.org> References: <1517950905-5015-1-git-send-email-floe@butterbrot.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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. */