.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2017 Samsung Electronics |
---|
3 | 4 | * |
---|
.. | .. |
---|
10 | 11 | * Erik Gilling <konkers@android.com> |
---|
11 | 12 | * Shankar Bandal <shankar.b@samsung.com> |
---|
12 | 13 | * 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 | | - * |
---|
27 | 14 | */ |
---|
28 | 15 | #include <drm/bridge/mhl.h> |
---|
| 16 | +#include <drm/drm_bridge.h> |
---|
29 | 17 | #include <drm/drm_crtc.h> |
---|
30 | 18 | #include <drm/drm_edid.h> |
---|
31 | 19 | |
---|
.. | .. |
---|
828 | 816 | static int sii9234_init_resources(struct sii9234 *ctx, |
---|
829 | 817 | struct i2c_client *client) |
---|
830 | 818 | { |
---|
831 | | - struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); |
---|
| 819 | + struct i2c_adapter *adapter = client->adapter; |
---|
832 | 820 | int ret; |
---|
833 | 821 | |
---|
834 | 822 | if (!ctx->dev->of_node) { |
---|
.. | .. |
---|
848 | 836 | ctx->supplies[3].supply = "cvcc12"; |
---|
849 | 837 | ret = devm_regulator_bulk_get(ctx->dev, 4, ctx->supplies); |
---|
850 | 838 | 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"); |
---|
852 | 841 | return ret; |
---|
853 | 842 | } |
---|
854 | 843 | |
---|
855 | 844 | ctx->client[I2C_MHL] = client; |
---|
856 | 845 | |
---|
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])) { |
---|
859 | 849 | dev_err(ctx->dev, "failed to create TPI client\n"); |
---|
860 | | - return -ENODEV; |
---|
| 850 | + return PTR_ERR(ctx->client[I2C_TPI]); |
---|
861 | 851 | } |
---|
862 | 852 | |
---|
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])) { |
---|
865 | 856 | dev_err(ctx->dev, "failed to create HDMI RX client\n"); |
---|
866 | | - goto fail_tpi; |
---|
| 857 | + return PTR_ERR(ctx->client[I2C_HDMI]); |
---|
867 | 858 | } |
---|
868 | 859 | |
---|
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])) { |
---|
871 | 863 | dev_err(ctx->dev, "failed to create CBUS client\n"); |
---|
872 | | - goto fail_hdmi; |
---|
| 864 | + return PTR_ERR(ctx->client[I2C_CBUS]); |
---|
873 | 865 | } |
---|
874 | 866 | |
---|
875 | 867 | 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]); |
---|
890 | 868 | } |
---|
891 | 869 | |
---|
892 | 870 | static inline struct sii9234 *bridge_to_sii9234(struct drm_bridge *bridge) |
---|
.. | .. |
---|
895 | 873 | } |
---|
896 | 874 | |
---|
897 | 875 | static enum drm_mode_status sii9234_mode_valid(struct drm_bridge *bridge, |
---|
| 876 | + const struct drm_display_info *info, |
---|
898 | 877 | const struct drm_display_mode *mode) |
---|
899 | 878 | { |
---|
900 | 879 | if (mode->clock > MHL1_MAX_CLK) |
---|
.. | .. |
---|
910 | 889 | static int sii9234_probe(struct i2c_client *client, |
---|
911 | 890 | const struct i2c_device_id *id) |
---|
912 | 891 | { |
---|
913 | | - struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); |
---|
| 892 | + struct i2c_adapter *adapter = client->adapter; |
---|
914 | 893 | struct sii9234 *ctx; |
---|
915 | 894 | struct device *dev = &client->dev; |
---|
916 | 895 | int ret; |
---|
.. | .. |
---|
963 | 942 | |
---|
964 | 943 | sii9234_cable_out(ctx); |
---|
965 | 944 | drm_bridge_remove(&ctx->bridge); |
---|
966 | | - sii9234_deinit_resources(ctx); |
---|
967 | 945 | |
---|
968 | 946 | return 0; |
---|
969 | 947 | } |
---|