Lines Matching refs:phy

33 	struct s3fwrn5_i2c_phy *phy = phy_id;  in s3fwrn5_i2c_set_mode()  local
35 mutex_lock(&phy->common.mutex); in s3fwrn5_i2c_set_mode()
37 if (s3fwrn5_phy_power_ctrl(&phy->common, mode) == false) in s3fwrn5_i2c_set_mode()
40 phy->irq_skip = true; in s3fwrn5_i2c_set_mode()
43 mutex_unlock(&phy->common.mutex); in s3fwrn5_i2c_set_mode()
48 struct s3fwrn5_i2c_phy *phy = phy_id; in s3fwrn5_i2c_write() local
51 mutex_lock(&phy->common.mutex); in s3fwrn5_i2c_write()
53 phy->irq_skip = false; in s3fwrn5_i2c_write()
55 ret = i2c_master_send(phy->i2c_dev, skb->data, skb->len); in s3fwrn5_i2c_write()
59 ret = i2c_master_send(phy->i2c_dev, skb->data, skb->len); in s3fwrn5_i2c_write()
62 mutex_unlock(&phy->common.mutex); in s3fwrn5_i2c_write()
80 static int s3fwrn5_i2c_read(struct s3fwrn5_i2c_phy *phy) in s3fwrn5_i2c_read() argument
88 hdr_size = (phy->common.mode == S3FWRN5_MODE_NCI) ? in s3fwrn5_i2c_read()
90 ret = i2c_master_recv(phy->i2c_dev, hdr, hdr_size); in s3fwrn5_i2c_read()
97 data_len = (phy->common.mode == S3FWRN5_MODE_NCI) ? in s3fwrn5_i2c_read()
110 ret = i2c_master_recv(phy->i2c_dev, skb_put(skb, data_len), data_len); in s3fwrn5_i2c_read()
117 return s3fwrn5_recv_frame(phy->common.ndev, skb, phy->common.mode); in s3fwrn5_i2c_read()
122 struct s3fwrn5_i2c_phy *phy = phy_id; in s3fwrn5_i2c_irq_thread_fn() local
124 if (!phy || !phy->common.ndev) { in s3fwrn5_i2c_irq_thread_fn()
129 mutex_lock(&phy->common.mutex); in s3fwrn5_i2c_irq_thread_fn()
131 if (phy->irq_skip) in s3fwrn5_i2c_irq_thread_fn()
134 switch (phy->common.mode) { in s3fwrn5_i2c_irq_thread_fn()
137 s3fwrn5_i2c_read(phy); in s3fwrn5_i2c_irq_thread_fn()
144 mutex_unlock(&phy->common.mutex); in s3fwrn5_i2c_irq_thread_fn()
151 struct s3fwrn5_i2c_phy *phy = i2c_get_clientdata(client); in s3fwrn5_i2c_parse_dt() local
157 phy->common.gpio_en = of_get_named_gpio(np, "en-gpios", 0); in s3fwrn5_i2c_parse_dt()
158 if (!gpio_is_valid(phy->common.gpio_en)) { in s3fwrn5_i2c_parse_dt()
160 phy->common.gpio_en = of_get_named_gpio(np, in s3fwrn5_i2c_parse_dt()
163 if (!gpio_is_valid(phy->common.gpio_en)) in s3fwrn5_i2c_parse_dt()
167 phy->common.gpio_fw_wake = of_get_named_gpio(np, "wake-gpios", 0); in s3fwrn5_i2c_parse_dt()
168 if (!gpio_is_valid(phy->common.gpio_fw_wake)) { in s3fwrn5_i2c_parse_dt()
170 phy->common.gpio_fw_wake = of_get_named_gpio(np, in s3fwrn5_i2c_parse_dt()
173 if (!gpio_is_valid(phy->common.gpio_fw_wake)) in s3fwrn5_i2c_parse_dt()
182 struct s3fwrn5_i2c_phy *phy; in s3fwrn5_i2c_probe() local
185 phy = devm_kzalloc(&client->dev, sizeof(*phy), GFP_KERNEL); in s3fwrn5_i2c_probe()
186 if (!phy) in s3fwrn5_i2c_probe()
189 mutex_init(&phy->common.mutex); in s3fwrn5_i2c_probe()
190 phy->common.mode = S3FWRN5_MODE_COLD; in s3fwrn5_i2c_probe()
191 phy->irq_skip = true; in s3fwrn5_i2c_probe()
193 phy->i2c_dev = client; in s3fwrn5_i2c_probe()
194 i2c_set_clientdata(client, phy); in s3fwrn5_i2c_probe()
200 ret = devm_gpio_request_one(&phy->i2c_dev->dev, phy->common.gpio_en, in s3fwrn5_i2c_probe()
205 ret = devm_gpio_request_one(&phy->i2c_dev->dev, in s3fwrn5_i2c_probe()
206 phy->common.gpio_fw_wake, in s3fwrn5_i2c_probe()
217 phy->clk = devm_clk_get_optional_enabled(&client->dev, NULL); in s3fwrn5_i2c_probe()
218 if (IS_ERR(phy->clk)) in s3fwrn5_i2c_probe()
219 return dev_err_probe(&client->dev, PTR_ERR(phy->clk), in s3fwrn5_i2c_probe()
222 ret = s3fwrn5_probe(&phy->common.ndev, phy, &phy->i2c_dev->dev, in s3fwrn5_i2c_probe()
227 ret = devm_request_threaded_irq(&client->dev, phy->i2c_dev->irq, NULL, in s3fwrn5_i2c_probe()
229 S3FWRN5_I2C_DRIVER_NAME, phy); in s3fwrn5_i2c_probe()
236 s3fwrn5_remove(phy->common.ndev); in s3fwrn5_i2c_probe()
242 struct s3fwrn5_i2c_phy *phy = i2c_get_clientdata(client); in s3fwrn5_i2c_remove() local
244 s3fwrn5_remove(phy->common.ndev); in s3fwrn5_i2c_remove()