hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/gpu/drm/bridge/sii9234.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (C) 2017 Samsung Electronics
34 *
....@@ -10,22 +11,9 @@
1011 * Erik Gilling <konkers@android.com>
1112 * Shankar Bandal <shankar.b@samsung.com>
1213 * Dharam Kumar <dharam.kr@samsung.com>
13
- *
14
- * This program is free software; you can redistribute it and/or modify
15
- * it under the terms of the GNU General Public License as published by
16
- * the Free Software Foundation; either version 2 of the License, or
17
- * (at your option) any later version.
18
- *
19
- * This program is distributed in the hope that it will be useful,
20
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
- * GNU General Public License for more details.
23
- *
24
- * You should have received a copy of the GNU General Public License
25
- * along with this program
26
- *
2714 */
2815 #include <drm/bridge/mhl.h>
16
+#include <drm/drm_bridge.h>
2917 #include <drm/drm_crtc.h>
3018 #include <drm/drm_edid.h>
3119
....@@ -828,7 +816,7 @@
828816 static int sii9234_init_resources(struct sii9234 *ctx,
829817 struct i2c_client *client)
830818 {
831
- struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
819
+ struct i2c_adapter *adapter = client->adapter;
832820 int ret;
833821
834822 if (!ctx->dev->of_node) {
....@@ -848,45 +836,35 @@
848836 ctx->supplies[3].supply = "cvcc12";
849837 ret = devm_regulator_bulk_get(ctx->dev, 4, ctx->supplies);
850838 if (ret) {
851
- dev_err(ctx->dev, "regulator_bulk failed\n");
839
+ if (ret != -EPROBE_DEFER)
840
+ dev_err(ctx->dev, "regulator_bulk failed\n");
852841 return ret;
853842 }
854843
855844 ctx->client[I2C_MHL] = client;
856845
857
- ctx->client[I2C_TPI] = i2c_new_dummy(adapter, I2C_TPI_ADDR);
858
- if (!ctx->client[I2C_TPI]) {
846
+ ctx->client[I2C_TPI] = devm_i2c_new_dummy_device(&client->dev, adapter,
847
+ I2C_TPI_ADDR);
848
+ if (IS_ERR(ctx->client[I2C_TPI])) {
859849 dev_err(ctx->dev, "failed to create TPI client\n");
860
- return -ENODEV;
850
+ return PTR_ERR(ctx->client[I2C_TPI]);
861851 }
862852
863
- ctx->client[I2C_HDMI] = i2c_new_dummy(adapter, I2C_HDMI_ADDR);
864
- if (!ctx->client[I2C_HDMI]) {
853
+ ctx->client[I2C_HDMI] = devm_i2c_new_dummy_device(&client->dev, adapter,
854
+ I2C_HDMI_ADDR);
855
+ if (IS_ERR(ctx->client[I2C_HDMI])) {
865856 dev_err(ctx->dev, "failed to create HDMI RX client\n");
866
- goto fail_tpi;
857
+ return PTR_ERR(ctx->client[I2C_HDMI]);
867858 }
868859
869
- ctx->client[I2C_CBUS] = i2c_new_dummy(adapter, I2C_CBUS_ADDR);
870
- if (!ctx->client[I2C_CBUS]) {
860
+ ctx->client[I2C_CBUS] = devm_i2c_new_dummy_device(&client->dev, adapter,
861
+ I2C_CBUS_ADDR);
862
+ if (IS_ERR(ctx->client[I2C_CBUS])) {
871863 dev_err(ctx->dev, "failed to create CBUS client\n");
872
- goto fail_hdmi;
864
+ return PTR_ERR(ctx->client[I2C_CBUS]);
873865 }
874866
875867 return 0;
876
-
877
-fail_hdmi:
878
- i2c_unregister_device(ctx->client[I2C_HDMI]);
879
-fail_tpi:
880
- i2c_unregister_device(ctx->client[I2C_TPI]);
881
-
882
- return -ENODEV;
883
-}
884
-
885
-static void sii9234_deinit_resources(struct sii9234 *ctx)
886
-{
887
- i2c_unregister_device(ctx->client[I2C_CBUS]);
888
- i2c_unregister_device(ctx->client[I2C_HDMI]);
889
- i2c_unregister_device(ctx->client[I2C_TPI]);
890868 }
891869
892870 static inline struct sii9234 *bridge_to_sii9234(struct drm_bridge *bridge)
....@@ -895,6 +873,7 @@
895873 }
896874
897875 static enum drm_mode_status sii9234_mode_valid(struct drm_bridge *bridge,
876
+ const struct drm_display_info *info,
898877 const struct drm_display_mode *mode)
899878 {
900879 if (mode->clock > MHL1_MAX_CLK)
....@@ -910,7 +889,7 @@
910889 static int sii9234_probe(struct i2c_client *client,
911890 const struct i2c_device_id *id)
912891 {
913
- struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
892
+ struct i2c_adapter *adapter = client->adapter;
914893 struct sii9234 *ctx;
915894 struct device *dev = &client->dev;
916895 int ret;
....@@ -963,7 +942,6 @@
963942
964943 sii9234_cable_out(ctx);
965944 drm_bridge_remove(&ctx->bridge);
966
- sii9234_deinit_resources(ctx);
967945
968946 return 0;
969947 }