Lines Matching +full:ddc +full:- +full:i2c +full:- +full:bus

14  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
30 #include <linux/i2c-algo-bit.h>
31 #include <linux/i2c.h>
76 struct mgag200_ddc *ddc = data; in mgag200_ddc_algo_bit_data_setsda() local
78 mga_i2c_set(ddc->mdev, ddc->data, state); in mgag200_ddc_algo_bit_data_setsda()
83 struct mgag200_ddc *ddc = data; in mgag200_ddc_algo_bit_data_setscl() local
85 mga_i2c_set(ddc->mdev, ddc->clock, state); in mgag200_ddc_algo_bit_data_setscl()
90 struct mgag200_ddc *ddc = data; in mgag200_ddc_algo_bit_data_getsda() local
92 return (mga_i2c_read_gpio(ddc->mdev) & ddc->data) ? 1 : 0; in mgag200_ddc_algo_bit_data_getsda()
97 struct mgag200_ddc *ddc = data; in mgag200_ddc_algo_bit_data_getscl() local
99 return (mga_i2c_read_gpio(ddc->mdev) & ddc->clock) ? 1 : 0; in mgag200_ddc_algo_bit_data_getscl()
104 struct mgag200_ddc *ddc = i2c_get_adapdata(adapter); in mgag200_ddc_algo_bit_data_pre_xfer() local
105 struct mga_device *mdev = ddc->mdev; in mgag200_ddc_algo_bit_data_pre_xfer()
109 * by acquiring the I/O-register lock. in mgag200_ddc_algo_bit_data_pre_xfer()
111 mutex_lock(&mdev->rmmio_lock); in mgag200_ddc_algo_bit_data_pre_xfer()
118 struct mgag200_ddc *ddc = i2c_get_adapdata(adapter); in mgag200_ddc_algo_bit_data_post_xfer() local
119 struct mga_device *mdev = ddc->mdev; in mgag200_ddc_algo_bit_data_post_xfer()
121 mutex_unlock(&mdev->rmmio_lock); in mgag200_ddc_algo_bit_data_post_xfer()
126 struct mgag200_ddc *ddc = res; in mgag200_ddc_release() local
128 i2c_del_adapter(&ddc->adapter); in mgag200_ddc_release()
133 struct drm_device *dev = &mdev->base; in mgag200_ddc_create()
134 const struct mgag200_device_info *info = mdev->info; in mgag200_ddc_create()
135 struct mgag200_ddc *ddc; in mgag200_ddc_create() local
140 ddc = drmm_kzalloc(dev, sizeof(*ddc), GFP_KERNEL); in mgag200_ddc_create()
141 if (!ddc) in mgag200_ddc_create()
142 return ERR_PTR(-ENOMEM); in mgag200_ddc_create()
148 ddc->mdev = mdev; in mgag200_ddc_create()
149 ddc->data = BIT(info->i2c.data_bit); in mgag200_ddc_create()
150 ddc->clock = BIT(info->i2c.clock_bit); in mgag200_ddc_create()
152 bit = &ddc->bit; in mgag200_ddc_create()
153 bit->data = ddc; in mgag200_ddc_create()
154 bit->setsda = mgag200_ddc_algo_bit_data_setsda; in mgag200_ddc_create()
155 bit->setscl = mgag200_ddc_algo_bit_data_setscl; in mgag200_ddc_create()
156 bit->getsda = mgag200_ddc_algo_bit_data_getsda; in mgag200_ddc_create()
157 bit->getscl = mgag200_ddc_algo_bit_data_getscl; in mgag200_ddc_create()
158 bit->pre_xfer = mgag200_ddc_algo_bit_data_pre_xfer; in mgag200_ddc_create()
159 bit->post_xfer = mgag200_ddc_algo_bit_data_post_xfer; in mgag200_ddc_create()
160 bit->udelay = 10; in mgag200_ddc_create()
161 bit->timeout = usecs_to_jiffies(2200); in mgag200_ddc_create()
163 adapter = &ddc->adapter; in mgag200_ddc_create()
164 adapter->owner = THIS_MODULE; in mgag200_ddc_create()
165 adapter->algo_data = bit; in mgag200_ddc_create()
166 adapter->dev.parent = dev->dev; in mgag200_ddc_create()
167 snprintf(adapter->name, sizeof(adapter->name), "Matrox DDC bus"); in mgag200_ddc_create()
168 i2c_set_adapdata(adapter, ddc); in mgag200_ddc_create()
174 ret = drmm_add_action_or_reset(dev, mgag200_ddc_release, ddc); in mgag200_ddc_create()