Lines Matching full:adv7511

3  * adv7511_cec.c - Analog Devices ADV7511/33 cec driver
16 #include "adv7511.h"
35 static void adv_cec_tx_raw_status(struct adv7511 *adv7511, u8 tx_raw_status) in adv_cec_tx_raw_status() argument
37 unsigned int offset = adv7511->reg_cec_offset; in adv_cec_tx_raw_status()
40 if (regmap_read(adv7511->regmap_cec, in adv_cec_tx_raw_status()
48 cec_transmit_attempt_done(adv7511->cec_adap, in adv_cec_tx_raw_status()
64 if (regmap_read(adv7511->regmap_cec, in adv_cec_tx_raw_status()
76 cec_transmit_done(adv7511->cec_adap, status, in adv_cec_tx_raw_status()
81 cec_transmit_attempt_done(adv7511->cec_adap, CEC_TX_STATUS_OK); in adv_cec_tx_raw_status()
86 static void adv7511_cec_rx(struct adv7511 *adv7511, int rx_buf) in adv7511_cec_rx() argument
88 unsigned int offset = adv7511->reg_cec_offset; in adv7511_cec_rx()
94 if (regmap_read(adv7511->regmap_cec, in adv7511_cec_rx()
107 regmap_read(adv7511->regmap_cec, in adv7511_cec_rx()
114 regmap_update_bits(adv7511->regmap_cec, in adv7511_cec_rx()
117 regmap_update_bits(adv7511->regmap_cec, in adv7511_cec_rx()
120 cec_received_msg(adv7511->cec_adap, &msg); in adv7511_cec_rx()
123 void adv7511_cec_irq_process(struct adv7511 *adv7511, unsigned int irq1) in adv7511_cec_irq_process() argument
125 unsigned int offset = adv7511->reg_cec_offset; in adv7511_cec_irq_process()
137 adv_cec_tx_raw_status(adv7511, irq1); in adv7511_cec_irq_process()
142 if (regmap_read(adv7511->regmap_cec, in adv7511_cec_irq_process()
174 adv7511_cec_rx(adv7511, rx_buf); in adv7511_cec_irq_process()
180 struct adv7511 *adv7511 = cec_get_drvdata(adap); in adv7511_cec_adap_enable() local
181 unsigned int offset = adv7511->reg_cec_offset; in adv7511_cec_adap_enable()
183 if (adv7511->i2c_cec == NULL) in adv7511_cec_adap_enable()
186 if (!adv7511->cec_enabled_adap && enable) { in adv7511_cec_adap_enable()
188 regmap_update_bits(adv7511->regmap_cec, in adv7511_cec_adap_enable()
192 regmap_write(adv7511->regmap_cec, in adv7511_cec_adap_enable()
194 regmap_write(adv7511->regmap_cec, in adv7511_cec_adap_enable()
197 regmap_update_bits(adv7511->regmap_cec, in adv7511_cec_adap_enable()
204 regmap_update_bits(adv7511->regmap, in adv7511_cec_adap_enable()
207 } else if (adv7511->cec_enabled_adap && !enable) { in adv7511_cec_adap_enable()
208 regmap_update_bits(adv7511->regmap, in adv7511_cec_adap_enable()
211 regmap_update_bits(adv7511->regmap_cec, in adv7511_cec_adap_enable()
215 regmap_update_bits(adv7511->regmap_cec, in adv7511_cec_adap_enable()
218 adv7511->cec_valid_addrs = 0; in adv7511_cec_adap_enable()
220 adv7511->cec_enabled_adap = enable; in adv7511_cec_adap_enable()
226 struct adv7511 *adv7511 = cec_get_drvdata(adap); in adv7511_cec_adap_log_addr() local
227 unsigned int offset = adv7511->reg_cec_offset; in adv7511_cec_adap_log_addr()
230 if (!adv7511->cec_enabled_adap) in adv7511_cec_adap_log_addr()
234 regmap_update_bits(adv7511->regmap_cec, in adv7511_cec_adap_log_addr()
237 adv7511->cec_valid_addrs = 0; in adv7511_cec_adap_log_addr()
242 bool is_valid = adv7511->cec_valid_addrs & (1 << i); in adv7511_cec_adap_log_addr()
246 if (is_valid && adv7511->cec_addr[i] == addr) in adv7511_cec_adap_log_addr()
254 adv7511->cec_addr[i] = addr; in adv7511_cec_adap_log_addr()
255 adv7511->cec_valid_addrs |= 1 << i; in adv7511_cec_adap_log_addr()
260 regmap_update_bits(adv7511->regmap_cec, in adv7511_cec_adap_log_addr()
264 regmap_update_bits(adv7511->regmap_cec, in adv7511_cec_adap_log_addr()
270 regmap_update_bits(adv7511->regmap_cec, in adv7511_cec_adap_log_addr()
274 regmap_update_bits(adv7511->regmap_cec, in adv7511_cec_adap_log_addr()
280 regmap_update_bits(adv7511->regmap_cec, in adv7511_cec_adap_log_addr()
284 regmap_update_bits(adv7511->regmap_cec, in adv7511_cec_adap_log_addr()
295 struct adv7511 *adv7511 = cec_get_drvdata(adap); in adv7511_cec_adap_transmit() local
296 unsigned int offset = adv7511->reg_cec_offset; in adv7511_cec_adap_transmit()
305 regmap_update_bits(adv7511->regmap_cec, in adv7511_cec_adap_transmit()
310 regmap_update_bits(adv7511->regmap, ADV7511_REG_INT(1), 0x38, 0x38); in adv7511_cec_adap_transmit()
314 regmap_write(adv7511->regmap_cec, in adv7511_cec_adap_transmit()
319 regmap_write(adv7511->regmap_cec, in adv7511_cec_adap_transmit()
322 regmap_write(adv7511->regmap_cec, in adv7511_cec_adap_transmit()
333 static int adv7511_cec_parse_dt(struct device *dev, struct adv7511 *adv7511) in adv7511_cec_parse_dt() argument
335 adv7511->cec_clk = devm_clk_get(dev, "cec"); in adv7511_cec_parse_dt()
336 if (IS_ERR(adv7511->cec_clk)) { in adv7511_cec_parse_dt()
337 int ret = PTR_ERR(adv7511->cec_clk); in adv7511_cec_parse_dt()
339 adv7511->cec_clk = NULL; in adv7511_cec_parse_dt()
342 clk_prepare_enable(adv7511->cec_clk); in adv7511_cec_parse_dt()
343 adv7511->cec_clk_freq = clk_get_rate(adv7511->cec_clk); in adv7511_cec_parse_dt()
347 int adv7511_cec_init(struct device *dev, struct adv7511 *adv7511) in adv7511_cec_init() argument
349 unsigned int offset = adv7511->reg_cec_offset; in adv7511_cec_init()
350 int ret = adv7511_cec_parse_dt(dev, adv7511); in adv7511_cec_init()
355 adv7511->cec_adap = cec_allocate_adapter(&adv7511_cec_adap_ops, in adv7511_cec_init()
356 adv7511, dev_name(dev), CEC_CAP_DEFAULTS, ADV7511_MAX_ADDRS); in adv7511_cec_init()
357 if (IS_ERR(adv7511->cec_adap)) { in adv7511_cec_init()
358 ret = PTR_ERR(adv7511->cec_adap); in adv7511_cec_init()
362 regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL, 0); in adv7511_cec_init()
364 regmap_write(adv7511->regmap_cec, in adv7511_cec_init()
366 regmap_write(adv7511->regmap_cec, in adv7511_cec_init()
370 regmap_write(adv7511->regmap_cec, in adv7511_cec_init()
373 regmap_write(adv7511->regmap_cec, in adv7511_cec_init()
375 ((adv7511->cec_clk_freq / 750000) - 1) << 2); in adv7511_cec_init()
377 ret = cec_register_adapter(adv7511->cec_adap, dev); in adv7511_cec_init()
383 cec_delete_adapter(adv7511->cec_adap); in adv7511_cec_init()
384 adv7511->cec_adap = NULL; in adv7511_cec_init()
389 regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL, in adv7511_cec_init()