From patchwork Sun Apr 24 21:08:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivaylo Dimitrov X-Patchwork-Id: 8921721 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C9841BF29F for ; Sun, 24 Apr 2016 21:11:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E3A4F201F2 for ; Sun, 24 Apr 2016 21:11:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 67DAE201EC for ; Sun, 24 Apr 2016 21:11:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753257AbcDXVK0 (ORCPT ); Sun, 24 Apr 2016 17:10:26 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:35663 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753259AbcDXVKU (ORCPT ); Sun, 24 Apr 2016 17:10:20 -0400 Received: by mail-wm0-f66.google.com with SMTP id e201so17586865wme.2 for ; Sun, 24 Apr 2016 14:10:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7HlujeeRZwbsKcMQbzEBiwimdWkSifmU6DT88arQevc=; b=GqoGDCIsPhI0QeSvxiT3RovOxv1WfFIrjoOeEzNukSnVQD1RMaLbLMxOOyO5A7PkZ+ BF94tgYT6qMWHe++QVPlT5xAqEVEncq2WKIzbMGNS7Udz0wMpHPDEOxya3olz7TfO7by YThRhnFIT4/uxf9+mqLWwSBss+UPNtKali89nkH2OAbL9FTTaZntpMa7sb19HLsKGnOV rTd/5FKALCXSe+9ci1ra4gY6VvUeOQ+oCMg8otzM1/D/DtTK7BFGa0wg63MxEA5MiKSA Ls7bNOqfSwlbd3+SrbXkX5G/7RY6+wGUsl++0Tvz6qPiYCHOBoz6S57lNbt5ATtxyQRW ReAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7HlujeeRZwbsKcMQbzEBiwimdWkSifmU6DT88arQevc=; b=aUQBlgTN+jSTiLYFlsfuIYnr5qj39KstFLk0PW3FuU+Dc+i9l0EtWEW49tPz2zLjgP iqi0hVnA+Y7bILggWKBn4afkxt+8T7KZyna1HftXFCoOp5W78qit9SHkhybiXFd1B1xw xC811XPw+2xhCzSeLl5dpgk2aFbodcaXzb/OkaH2KDKTRY0+ro792iDT+rIezIBNlhqc 4PvAskJyDbxJXyEIBBaS8x1b6KkgNc8MgspaHqTZ8cNv7NQIgpM2milVpo9Gw1dcshyB ZiYuB9eURE2pPbCiQmpHu0GHLogqY/ej/Gtrhs1RfdP6A6GlGCvDaRa0VtNmEnrEzBTf ljFA== X-Gm-Message-State: AOPr4FWVmNrH161vnjqy5SJfLAfb1yRSyUzqFdPDKRlUjJHIeh3IGB0xgOQ9LS1iKMSjSg== X-Received: by 10.28.25.67 with SMTP id 64mr8552559wmz.10.1461532219269; Sun, 24 Apr 2016 14:10:19 -0700 (PDT) Received: from localhost.localdomain ([46.249.74.23]) by smtp.gmail.com with ESMTPSA id b2sm15440182wmb.9.2016.04.24.14.10.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 24 Apr 2016 14:10:18 -0700 (PDT) From: Ivaylo Dimitrov To: sakari.ailus@iki.fi Cc: sre@kernel.org, pali.rohar@gmail.com, pavel@ucw.cz, linux-media@vger.kernel.org, Sakari Ailus Subject: [RFC PATCH 06/24] smiapp: Add quirk control support Date: Mon, 25 Apr 2016 00:08:06 +0300 Message-Id: <1461532104-24032-7-git-send-email-ivo.g.dimitrov.75@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1461532104-24032-1-git-send-email-ivo.g.dimitrov.75@gmail.com> References: <20160420081427.GZ32125@valkosipuli.retiisi.org.uk> <1461532104-24032-1-git-send-email-ivo.g.dimitrov.75@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sakari Ailus Quirk controls can be set up in the init quirk. Signed-off-by: Sakari Ailus --- drivers/media/i2c/smiapp/smiapp-core.c | 6 ++++++ drivers/media/i2c/smiapp/smiapp-quirk.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c index 3dfe387..c6a897b 100644 --- a/drivers/media/i2c/smiapp/smiapp-core.c +++ b/drivers/media/i2c/smiapp/smiapp-core.c @@ -412,6 +412,12 @@ static int smiapp_set_ctrl(struct v4l2_ctrl *ctrl) int exposure; int rval; + rval = smiapp_call_quirk(sensor, s_ctrl, ctrl); + if (rval < 0) + return rval; + if (rval > 0) + return 0; + switch (ctrl->id) { case V4L2_CID_ANALOGUE_GAIN: return smiapp_write( diff --git a/drivers/media/i2c/smiapp/smiapp-quirk.h b/drivers/media/i2c/smiapp/smiapp-quirk.h index 209818f..504c16a 100644 --- a/drivers/media/i2c/smiapp/smiapp-quirk.h +++ b/drivers/media/i2c/smiapp/smiapp-quirk.h @@ -32,6 +32,8 @@ struct smiapp_sensor; * @pll_flags: Return flags for the PLL calculator. * @init: Quirk initialisation, called the last in probe(). This is * also appropriate for adding sensor specific controls, for instance. + * @s_ctrl: Set control quirk. Returns 0 if the control isn't + * implemented by the quirk, > 0 if it is. * @reg_access: Register access quirk. The quirk may divert the access * to another register, or no register at all. * @@ -51,6 +53,7 @@ struct smiapp_quirk { int (*post_streamoff)(struct smiapp_sensor *sensor); unsigned long (*pll_flags)(struct smiapp_sensor *sensor); int (*init)(struct smiapp_sensor *sensor); + int (*s_ctrl)(struct smiapp_sensor *sensor, struct v4l2_ctrl *ctrl); int (*reg_access)(struct smiapp_sensor *sensor, bool write, u32 *reg, u32 *val); unsigned long flags;