From patchwork Thu Jul 28 13:02:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 594154 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86E7EC19F21 for ; Thu, 28 Jul 2022 13:02:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238489AbiG1NCt (ORCPT ); Thu, 28 Jul 2022 09:02:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236063AbiG1NCs (ORCPT ); Thu, 28 Jul 2022 09:02:48 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CC0331921; Thu, 28 Jul 2022 06:02:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1659013367; x=1690549367; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jHGCy+LY2xn86PxwDOHDZMu5ODeZxv+Kr+sz0BLuCiI=; b=kgePlvyEqNOKZc/fvox90VcBtIBBK25kBBHPBYO2tmOrXWVmV/uoPza9 EobQpBYGqlakiTkzfxbpN0wtAF3Lw0ISPfUpPpqVMet6PPH5NnjUBVMug R8Bhm5EKFnKYbpHXvChqqPguGWBTLiLaG2EGfA0u+xS1TePvUNU09oTDP wN/Iv1ODoUShP2HYbbcFg6B0FxeblPzWKySp7JdcFU77iElTzx8i2IllP A/opAWLdReEttUB04wyAAos2l0TyIN8MaBmNHkGMPrQ8lqT+s1GDg2Fhn zGNq2g/o5Mz8S3ffYTiVPLCdeVcmeOafdTLSdaWUJ1PZHXXRfWEZdXsAw g==; X-IronPort-AV: E=Sophos;i="5.93,198,1654552800"; d="scan'208";a="25321365" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 28 Jul 2022 15:02:43 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Thu, 28 Jul 2022 15:02:43 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Thu, 28 Jul 2022 15:02:43 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1659013363; x=1690549363; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jHGCy+LY2xn86PxwDOHDZMu5ODeZxv+Kr+sz0BLuCiI=; b=YBCFy4egfC0LJlW7SvO8ERJqt401SBWGyHa6W8q1AuuxBEIJ81FHMilW F5Jx+hPxzIyF1rE3pXYXXSS2EFxN/fQSj89ZdBzhgPX2VI/qiz146wzfS NNxI3s5jagFEzTwAOFjnjVAuAJ5YnIRJ/dp1TbssyttU0VjPtEr89lW0f FIUwEc9SzzF7nlWBrAVKtB/bVWQEqc74sTCdfuoEh12m50NrEmB+OXm8K MSEBXhtEEV+ZFCc7jV0+g8gdmvPIs8mvtjVJ4FHI1FBdRIE46g2vSZVF+ xykwX6XXGhL27tpa6njwRWB2stZRWgRtMahXx4F0HjRIACt9ai//dw58G Q==; X-IronPort-AV: E=Sophos;i="5.93,198,1654552800"; d="scan'208";a="25321364" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 28 Jul 2022 15:02:43 +0200 Received: from steina-w.tq-net.de (unknown [10.123.49.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 588AB280072; Thu, 28 Jul 2022 15:02:43 +0200 (CEST) From: Alexander Stein To: "Paul J . Murphy" , Daniele Alessandrelli , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski Cc: Alexander Stein , linux-media@vger.kernel.org, devicetree@vger.kernel.org, Sakari Ailus Subject: [PATCH v4 1/7] media: i2c: ov9282: remove unused and unset i2c_client member Date: Thu, 28 Jul 2022 15:02:31 +0200 Message-Id: <20220728130237.3396663-2-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220728130237.3396663-1-alexander.stein@ew.tq-group.com> References: <20220728130237.3396663-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This is not need anyway as the i2c_client is stored in v4l2_subdev. Signed-off-by: Alexander Stein Acked-by: Daniele Alessandrelli --- drivers/media/i2c/ov9282.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/media/i2c/ov9282.c b/drivers/media/i2c/ov9282.c index 2e0b315801e5..8a252bf3b59f 100644 --- a/drivers/media/i2c/ov9282.c +++ b/drivers/media/i2c/ov9282.c @@ -104,7 +104,6 @@ struct ov9282_mode { /** * struct ov9282 - ov9282 sensor device structure * @dev: Pointer to generic device - * @client: Pointer to i2c client * @sd: V4L2 sub-device * @pad: Media pad. Only one pad supported * @reset_gpio: Sensor reset gpio @@ -123,7 +122,6 @@ struct ov9282_mode { */ struct ov9282 { struct device *dev; - struct i2c_client *client; struct v4l2_subdev sd; struct media_pad pad; struct gpio_desc *reset_gpio; From patchwork Thu Jul 28 13:02:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 594153 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BF18C19F21 for ; Thu, 28 Jul 2022 13:02:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236063AbiG1NCw (ORCPT ); Thu, 28 Jul 2022 09:02:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238516AbiG1NCv (ORCPT ); Thu, 28 Jul 2022 09:02:51 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AE33402DD; Thu, 28 Jul 2022 06:02:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1659013370; x=1690549370; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DZEpBns6FBLrwGth9N0WA8nJfnM4oXu/eo0E3+I9z84=; b=G/2mPJJMGUqf/aMpvnAXMDeJ1dOU81mnhkH0/F3XYyBur169MrOZCJrg mTNIUDzxr7KZMQUSxFqOWyysU/5AcItVEq4tN5I2/SG+g9Ba+eve0OhX1 b9fse2uAuC6FJo7ihqBBdehYvpIciWiwsqzfp7MzQisUMdOh2wjZ8Azf2 Bmuf4xTKuCnOEXD6j92Nv/wmhfDHv7fRmMcfuvl/AuvaU0ls4dPrpc1rk jHy8uazfsBDPlekSjfthdg76dPWpMPb5CJu7VVS7gZqcYPDuolVTdrXfu 86Tb1VGoZeoRMRGNdQlAVRYAuNtLwI9v15T19KG+pcyuIdcsbb1iPoqUv Q==; X-IronPort-AV: E=Sophos;i="5.93,198,1654552800"; d="scan'208";a="25321371" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 28 Jul 2022 15:02:44 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Thu, 28 Jul 2022 15:02:44 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Thu, 28 Jul 2022 15:02:44 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1659013364; x=1690549364; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DZEpBns6FBLrwGth9N0WA8nJfnM4oXu/eo0E3+I9z84=; b=iUubRkMrhHF5+nUgCtuNwnMYmEf5HYrNKrkwfATbYGPWs9eRzK9rotJk XrDWP+iU8Q0wnfhTaY6PVzA/x6/7eWCr8x/Q00q4SWIOTF3P1ABUc9zN9 GQT43Y3ETCQBrKCKnOMLCWuc0IeyFgrEFRyTTsGdeRZMG9jDf5Q+L1RFX Z+McO42spPX4OWL2gSqFZZlT5/L/PmPpV5Z6I7GdZSKSNviLTvs9EUPuu c4E2MS+OYW/yhPyy3o+NtNQEIvZpyxvq9lYWrnoJmLq8ERAXyfwSXYK90 4JJAOlvmqlyyemsZMOSOvM1pyvDE4sZAgSKbKeuacckRRMJokjFEnra55 Q==; X-IronPort-AV: E=Sophos;i="5.93,198,1654552800"; d="scan'208";a="25321370" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 28 Jul 2022 15:02:44 +0200 Received: from steina-w.tq-net.de (unknown [10.123.49.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id DD4D3280073; Thu, 28 Jul 2022 15:02:43 +0200 (CEST) From: Alexander Stein To: "Paul J . Murphy" , Daniele Alessandrelli , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski Cc: Alexander Stein , linux-media@vger.kernel.org, devicetree@vger.kernel.org, Sakari Ailus , Krzysztof Kozlowski Subject: [PATCH v4 4/7] media: dt-bindings: media: ov9282: Add power supply properties Date: Thu, 28 Jul 2022 15:02:34 +0200 Message-Id: <20220728130237.3396663-5-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220728130237.3396663-1-alexander.stein@ew.tq-group.com> References: <20220728130237.3396663-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add regulators for each power domain. Signed-off-by: Alexander Stein Acked-by: Krzysztof Kozlowski --- .../devicetree/bindings/media/i2c/ovti,ov9282.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Documentation/devicetree/bindings/media/i2c/ovti,ov9282.yaml b/Documentation/devicetree/bindings/media/i2c/ovti,ov9282.yaml index 285f8c85f253..9abfaabd373a 100644 --- a/Documentation/devicetree/bindings/media/i2c/ovti,ov9282.yaml +++ b/Documentation/devicetree/bindings/media/i2c/ovti,ov9282.yaml @@ -39,6 +39,15 @@ properties: description: Reference to the GPIO connected to the XCLR pin, if any. maxItems: 1 + avdd-supply: + description: Analog power supply + + dovdd-supply: + description: Digital I/O power supply + + dvdd-supply: + description: Digital core supply + port: additionalProperties: false $ref: /schemas/graph.yaml#/$defs/port-base From patchwork Thu Jul 28 13:02:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 594152 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2546CC04A68 for ; Thu, 28 Jul 2022 13:02:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238859AbiG1NCx (ORCPT ); Thu, 28 Jul 2022 09:02:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238655AbiG1NCv (ORCPT ); Thu, 28 Jul 2022 09:02:51 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34CDE40BF8; Thu, 28 Jul 2022 06:02:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1659013370; x=1690549370; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eUVoM8eILSRtiJWPnfEMpUTwJ5DdzPLtU9RvqhESVtc=; b=mgKv2/jhBf+FU4p2CY0+/kj+H9M49yi3LWTIUlLK7CI4ngQuu/3LsYub 2cWVCMI6Aq4jS2Zfk/WSh/wNESoVVFhbAp6LMLD+9Iv2LssIfQ8iyABcn Yrkjhbbo042LTTfOGeYWsqCvN/vkSJJaShn1w1pHdR1sFKGxHxaPjvAEe ZnAxb8leT7/CUO3N20z5gLtfAdOvwRzLceCrGwqSJ13UxoGcJFt8LBeL8 IZcv6rk7SKU/RqChR48Kgs1+Xmq7DUzXStJKZfopUBnZ/uRweBQgF3Tjo tedN3fZnp9gw56VJMnz5muH6suQc0fnsoffnWqvD6eolYuS7QwO45KiMS A==; X-IronPort-AV: E=Sophos;i="5.93,198,1654552800"; d="scan'208";a="25321373" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 28 Jul 2022 15:02:44 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Thu, 28 Jul 2022 15:02:44 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Thu, 28 Jul 2022 15:02:44 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1659013364; x=1690549364; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eUVoM8eILSRtiJWPnfEMpUTwJ5DdzPLtU9RvqhESVtc=; b=YOdtc5+BX264kYfXAYnzbuyq2GV6rqWe+yY23UlhE3vQRMbRE6cGp3jG fEH6KDyefpBciSMKxDZbbf98LEVtIHVfN6qYCkNjqOf7WrB9TBcSR+E6u bTyf7bQhbH/vIfqSncOeZARvgMH5Izf05EWLuhfDkiD9lg2lbzcOF8Ty0 DGOjE4Hicvd91EQI3e/winH0YErI83sGSSMszDFr0JZNhKpkU2MgRGzlS 5AVl5IxF0jqjD/rlj1ow+OA0A4AAf8Sox1WjjEfRjJp9g9BQYokHUx1NN WiMxQjKiAeujXAqH0/kEeagnElPDekSThnaTSMxxdl4hj4Ici4QL+gvUM A==; X-IronPort-AV: E=Sophos;i="5.93,198,1654552800"; d="scan'208";a="25321372" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 28 Jul 2022 15:02:44 +0200 Received: from steina-w.tq-net.de (unknown [10.123.49.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 138A2280056; Thu, 28 Jul 2022 15:02:44 +0200 (CEST) From: Alexander Stein To: "Paul J . Murphy" , Daniele Alessandrelli , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski Cc: Alexander Stein , linux-media@vger.kernel.org, devicetree@vger.kernel.org, Sakari Ailus Subject: [PATCH v4 5/7] media: i2c: ov9282: Add regulator support Date: Thu, 28 Jul 2022 15:02:35 +0200 Message-Id: <20220728130237.3396663-6-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220728130237.3396663-1-alexander.stein@ew.tq-group.com> References: <20220728130237.3396663-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Need in case the sensors is supplied by a switchable regulator. Signed-off-by: Alexander Stein --- drivers/media/i2c/ov9282.c | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/drivers/media/i2c/ov9282.c b/drivers/media/i2c/ov9282.c index c8d83a29f9bb..352dbe21a902 100644 --- a/drivers/media/i2c/ov9282.c +++ b/drivers/media/i2c/ov9282.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -55,6 +56,14 @@ #define OV9282_REG_MIN 0x00 #define OV9282_REG_MAX 0xfffff +static const char * const ov9282_supply_names[] = { + "avdd", /* Analog power */ + "dovdd", /* Digital I/O power */ + "dvdd", /* Digital core power */ +}; + +#define OV9282_NUM_SUPPLIES ARRAY_SIZE(ov9282_supply_names) + /** * struct ov9282_reg - ov9282 sensor register * @address: Register address @@ -126,6 +135,7 @@ struct ov9282 { struct media_pad pad; struct gpio_desc *reset_gpio; struct clk *inclk; + struct regulator_bulk_data supplies[OV9282_NUM_SUPPLIES]; struct v4l2_ctrl_handler ctrl_handler; struct v4l2_ctrl *link_freq_ctrl; struct v4l2_ctrl *pclk_ctrl; @@ -882,10 +892,19 @@ static int ov9282_power_on(struct device *dev) goto error_reset; } + ret = regulator_bulk_enable(ARRAY_SIZE(ov9282->supplies), + ov9282->supplies); + if (ret) { + dev_err(dev, "Failed to enable regulators\n"); + goto disable_clk; + } + usleep_range(400, 600); return 0; +disable_clk: + clk_disable_unprepare(ov9282->inclk); error_reset: gpiod_set_value_cansleep(ov9282->reset_gpio, 0); @@ -903,6 +922,8 @@ static int ov9282_power_off(struct device *dev) struct v4l2_subdev *sd = dev_get_drvdata(dev); struct ov9282 *ov9282 = to_ov9282(sd); + regulator_bulk_disable(ARRAY_SIZE(ov9282->supplies), ov9282->supplies); + gpiod_set_value_cansleep(ov9282->reset_gpio, 0); clk_disable_unprepare(ov9282->inclk); @@ -995,6 +1016,18 @@ static int ov9282_init_controls(struct ov9282 *ov9282) return 0; } +static int ov9282_get_regulators(struct ov9282 *ov9282) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(ov9282->supplies); i++) + ov9282->supplies[i].supply = ov9282_supply_names[i]; + + return devm_regulator_bulk_get(ov9282->dev, + ARRAY_SIZE(ov9282->supplies), + ov9282->supplies); +} + /** * ov9282_probe() - I2C client device binding * @client: pointer to i2c client device @@ -1021,6 +1054,12 @@ static int ov9282_probe(struct i2c_client *client) return ret; } + ret = ov9282_get_regulators(ov9282); + if (ret) { + dev_err(&client->dev, "Failed to get power regulators\n"); + return ret; + } + mutex_init(&ov9282->mutex); ret = ov9282_power_on(ov9282->dev); From patchwork Thu Jul 28 13:02:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 594151 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80055C19F2C for ; Thu, 28 Jul 2022 13:02:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238846AbiG1NCy (ORCPT ); Thu, 28 Jul 2022 09:02:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238837AbiG1NCw (ORCPT ); Thu, 28 Jul 2022 09:02:52 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EEA746D81; Thu, 28 Jul 2022 06:02:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1659013370; x=1690549370; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CGHyMONZ2wrKJUIuy4ZNGqJusCkm0oXUk4BvqHTAOwU=; b=MNTBc7Fbln2ij6NNxC7QJ5oUlU4mYb8Ctl61cp+hWhYZTeOf8wBpvXKf muWAo5EiFXIiSdNDArfglqHT1x8u3hJYV3B9bZ6eqAig5OcRDOBoi8ZVr F+U04F90c5dO1DmVxL/+HwzS6U252CLfS9jXqiFuO2G38GTWfnYnMrEZp a2V4tWYPIUcYncbXPwOnE9XZ3en02jf93upFZs7/vW1+I7AT4x3BDi1MZ ncs3GAhpamRl0DGjitRVDTD6SM1qvpwFuWmkMph7VR7hmX/T7UHSjUU/6 Qk0Y235Ddgr+hW8rqK5Kcs1eoRtyzulbrxA0he2Ck6shTISSmDEe4GIs7 w==; X-IronPort-AV: E=Sophos;i="5.93,198,1654552800"; d="scan'208";a="25321375" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 28 Jul 2022 15:02:44 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Thu, 28 Jul 2022 15:02:44 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Thu, 28 Jul 2022 15:02:44 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1659013364; x=1690549364; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CGHyMONZ2wrKJUIuy4ZNGqJusCkm0oXUk4BvqHTAOwU=; b=Ka5mZJhxRXR4V9p/9rpGyYb8Gww8tSV0sSccCKFuQR/lr/BR71t0s9Jn KqLsMsYfixhjR3I9/t6bnmaQCP2nE9xx5p1oOxtCbDk7kbG9f23UY4M6U WvMYJ8Yd+23iUgFzxem+1xwsEIEtMZoJN4amGgx5mTQvntpYaYbipql4L T8Hn01vXuwAvKm9kZH3xqPwJ3j2340V26CRNpZwJC56tOw2o8zfgJZOLl NkXbWRkNnDHBwhOheI/tF8EzJWjoLvYHojWboQNA2HieCTPaSifNk4NyI n377YMLZ3/+FoRq/mkSu+Vb+8q4xJWJ0L302WK9kPWIkByTzx9GKPyAwF A==; X-IronPort-AV: E=Sophos;i="5.93,198,1654552800"; d="scan'208";a="25321374" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 28 Jul 2022 15:02:44 +0200 Received: from steina-w.tq-net.de (unknown [10.123.49.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 3B440280072; Thu, 28 Jul 2022 15:02:44 +0200 (CEST) From: Alexander Stein To: "Paul J . Murphy" , Daniele Alessandrelli , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski Cc: Alexander Stein , linux-media@vger.kernel.org, devicetree@vger.kernel.org, Sakari Ailus Subject: [PATCH v4 6/7] media: i2c: ov9282: Set v4l2 subdev name according to sensor model Date: Thu, 28 Jul 2022 15:02:36 +0200 Message-Id: <20220728130237.3396663-7-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220728130237.3396663-1-alexander.stein@ew.tq-group.com> References: <20220728130237.3396663-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org To distinguish ov9281 & ov9282 the name has to be explicitly set. Provide a fixed string using platform data. Signed-off-by: Alexander Stein --- Changes in v4: * Replaced v4l2_i2c_subdev_set_name with device_get_match_data and added platform data containing the sensor name drivers/media/i2c/ov9282.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/ov9282.c b/drivers/media/i2c/ov9282.c index 352dbe21a902..f79bdfa821e8 100644 --- a/drivers/media/i2c/ov9282.c +++ b/drivers/media/i2c/ov9282.c @@ -1037,6 +1037,7 @@ static int ov9282_get_regulators(struct ov9282 *ov9282) static int ov9282_probe(struct i2c_client *client) { struct ov9282 *ov9282; + const char *sensor_name; int ret; ov9282 = devm_kzalloc(&client->dev, sizeof(*ov9282), GFP_KERNEL); @@ -1047,6 +1048,12 @@ static int ov9282_probe(struct i2c_client *client) /* Initialize subdev */ v4l2_i2c_subdev_init(&ov9282->sd, client, &ov9282_subdev_ops); + sensor_name = device_get_match_data(ov9282->dev); + if (!sensor_name) { + dev_err(ov9282->dev, "Sensor name is missing"); + return ret; + } + v4l2_i2c_subdev_set_name(&ov9282->sd, client, sensor_name, NULL); ret = ov9282_parse_hw_config(ov9282); if (ret) { @@ -1152,8 +1159,8 @@ static const struct dev_pm_ops ov9282_pm_ops = { }; static const struct of_device_id ov9282_of_match[] = { - { .compatible = "ovti,ov9281" }, - { .compatible = "ovti,ov9282" }, + { .compatible = "ovti,ov9281", .data = "ov9281" }, + { .compatible = "ovti,ov9282", .data = "ov9282" }, { } };