€•³lŒsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”(hhŒparent”hubaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ"/translations/zh_CN/driver-api/pwm”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”(hhhh2ubah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ"/translations/zh_TW/driver-api/pwm”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”(hhhhFubah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ"/translations/it_IT/driver-api/pwm”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”(hhhhZubah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ"/translations/ja_JP/driver-api/pwm”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”(hhhhnubah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ"/translations/ko_KR/driver-api/pwm”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”(hhhh‚ubah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ"/translations/sp_SP/driver-api/pwm”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒ&Pulse Width Modulation (PWM) interface”h]”hŒ&Pulse Width Modulation (PWM) interface”…””}”(hhªhh¨hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¦hh£hžhhŸŒubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hj(ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j&hŸh¶h Kfhj#ubj')”}”(hŒ>export Exports a PWM channel for use with sysfs (write-only). ”h]”(j-)”}”(hŒexport”h]”hŒexport”…””}”(hjahj_hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j,hŸh¶h Kihj[ubj=)”}”(hhh]”h¸)”}”(hŒ6Exports a PWM channel for use with sysfs (write-only).”h]”hŒ6Exports a PWM channel for use with sysfs (write-only).”…””}”(hjrhjphžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Kihjmubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hj[ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j&hŸh¶h Kihj#ubj')”}”(hŒ:unexport Unexports a PWM channel from sysfs (write-only). ”h]”(j-)”}”(hŒunexport”h]”hŒunexport”…””}”(hjhjŽhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j,hŸh¶h KlhjŠubj=)”}”(hhh]”h¸)”}”(hŒ0Unexports a PWM channel from sysfs (write-only).”h]”hŒ0Unexports a PWM channel from sysfs (write-only).”…””}”(hj¡hjŸhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Klhjœubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjŠubeh}”(h]”h ]”h"]”h$]”h&]”uh1j&hŸh¶h Klhj#ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j!hjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjýhžhhŸNh Nubh¸)”}”(hŒFThe PWM channels are numbered using a per-chip index from 0 to npwm-1.”h]”hŒFThe PWM channels are numbered using a per-chip index from 0 to npwm-1.”…””}”(hjÇhjÅhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Knhjýhžhubh¸)”}”(hŒÙWhen a PWM channel is exported a pwmX directory will be created in the pwmchipN directory it is associated with, where X is the number of the channel that was exported. The following properties will then be available:”h]”hŒÙWhen a PWM channel is exported a pwmX directory will be created in the pwmchipN directory it is associated with, where X is the number of the channel that was exported. The following properties will then be available:”…””}”(hjÕhjÓhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Kphjýhžhubj)”}”(hhh]”j")”}”(hhh]”(j')”}”(hŒ‹period The total period of the PWM signal (read/write). Value is in nanoseconds and is the sum of the active and inactive time of the PWM. ”h]”(j-)”}”(hŒperiod”h]”hŒperiod”…””}”(hjíhjëhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j,hŸh¶h Kwhjçubj=)”}”(hhh]”h¸)”}”(hŒƒThe total period of the PWM signal (read/write). Value is in nanoseconds and is the sum of the active and inactive time of the PWM.”h]”hŒƒThe total period of the PWM signal (read/write). Value is in nanoseconds and is the sum of the active and inactive time of the PWM.”…””}”(hjþhjühžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Kuhjùubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjçubeh}”(h]”h ]”h"]”h$]”h&]”uh1j&hŸh¶h Kwhjäubj')”}”(hŒduty_cycle The active time of the PWM signal (read/write). Value is in nanoseconds and must be less than or equal to the period. ”h]”(j-)”}”(hŒ duty_cycle”h]”hŒ duty_cycle”…””}”(hjhjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j,hŸh¶h K{hjubj=)”}”(hhh]”h¸)”}”(hŒuThe active time of the PWM signal (read/write). Value is in nanoseconds and must be less than or equal to the period.”h]”hŒuThe active time of the PWM signal (read/write). Value is in nanoseconds and must be less than or equal to the period.”…””}”(hj-hj+hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Kzhj(ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjubeh}”(h]”h ]”h"]”h$]”h&]”uh1j&hŸh¶h K{hjäubj')”}”(hŒ¼polarity Changes the polarity of the PWM signal (read/write). Writes to this property only work if the PWM chip supports changing the polarity. Value is the string "normal" or "inversed". ”h]”(j-)”}”(hŒpolarity”h]”hŒpolarity”…””}”(hjKhjIhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j,hŸh¶h KhjEubj=)”}”(hhh]”h¸)”}”(hŒ²Changes the polarity of the PWM signal (read/write). Writes to this property only work if the PWM chip supports changing the polarity. Value is the string "normal" or "inversed".”h]”hŒºChanges the polarity of the PWM signal (read/write). Writes to this property only work if the PWM chip supports changing the polarity. Value is the string “normal†or “inversedâ€.”…””}”(hj\hjZhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K~hjWubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjEubeh}”(h]”h ]”h"]”h$]”h&]”uh1j&hŸh¶h Khjäubj')”}”(hŒYenable Enable/disable the PWM signal (read/write). - 0 - disabled - 1 - enabled ”h]”(j-)”}”(hŒenable”h]”hŒenable”…””}”(hjzhjxhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j,hŸh¶h K‡hjtubj=)”}”(hhh]”(h¸)”}”(hŒ+Enable/disable the PWM signal (read/write).”h]”hŒ+Enable/disable the PWM signal (read/write).”…””}”(hj‹hj‰hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K„hj†ubj)”}”(hhh]”hŒ bullet_list”“”)”}”(hhh]”(hŒ list_item”“”)”}”(hŒ 0 - disabled”h]”h¸)”}”(hj£h]”hŒ 0 - disabled”…””}”(hj£hj¥hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K†hj¡ubah}”(h]”h ]”h"]”h$]”h&]”uh1jŸhjœubj )”}”(hŒ 1 - enabled ”h]”h¸)”}”(hŒ 1 - enabled”h]”hŒ 1 - enabled”…””}”(hj¾hj¼hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K‡hj¸ubah}”(h]”h ]”h"]”h$]”h&]”uh1jŸhjœubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ-”uh1jšhŸh¶h K†hj—ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj†ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j<hjtubeh}”(h]”h ]”h"]”h$]”h&]”uh1j&hŸh¶h K‡hjäubeh}”(h]”h ]”h"]”h$]”h&]”uh1j!hjáubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjýhžhhŸNh Nubeh}”(h]”Œ#using-pwms-with-the-sysfs-interface”ah ]”h"]”Œ#using pwms with the sysfs interface”ah$]”h&]”uh1h¡hh£hžhhŸh¶h K]ubh¢)”}”(hhh]”(h§)”}”(hŒImplementing a PWM driver”h]”hŒImplementing a PWM driver”…””}”(hjhjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¦hjþhžhhŸh¶h KŠubh¸)”}”(hXNCurrently there are two ways to implement pwm drivers. Traditionally there only has been the barebone API meaning that each driver has to implement the pwm_*() functions itself. This means that it's impossible to have multiple PWM drivers in the system. For this reason it's mandatory for new drivers to use the generic PWM framework.”h]”hXRCurrently there are two ways to implement pwm drivers. Traditionally there only has been the barebone API meaning that each driver has to implement the pwm_*() functions itself. This means that it’s impossible to have multiple PWM drivers in the system. For this reason it’s mandatory for new drivers to use the generic PWM framework.”…””}”(hjhjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h KŒhjþhžhubh¸)”}”(hX©A new PWM controller/chip can be allocated using pwmchip_alloc(), then registered using pwmchip_add() and removed again with pwmchip_remove(). To undo pwmchip_alloc() use pwmchip_put(). pwmchip_add() takes a filled in struct pwm_chip as argument which provides a description of the PWM chip, the number of PWM devices provided by the chip and the chip-specific implementation of the supported PWM operations to the framework.”h]”hX©A new PWM controller/chip can be allocated using pwmchip_alloc(), then registered using pwmchip_add() and removed again with pwmchip_remove(). To undo pwmchip_alloc() use pwmchip_put(). pwmchip_add() takes a filled in struct pwm_chip as argument which provides a description of the PWM chip, the number of PWM devices provided by the chip and the chip-specific implementation of the supported PWM operations to the framework.”…””}”(hjhjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K’hjþhžhubh¸)”}”(hX‘When implementing polarity support in a PWM driver, make sure to respect the signal conventions in the PWM framework. By definition, normal polarity characterizes a signal starts high for the duration of the duty cycle and goes low for the remainder of the period. Conversely, a signal with inversed polarity starts low for the duration of the duty cycle and goes high for the remainder of the period.”h]”hX‘When implementing polarity support in a PWM driver, make sure to respect the signal conventions in the PWM framework. By definition, normal polarity characterizes a signal starts high for the duration of the duty cycle and goes low for the remainder of the period. Conversely, a signal with inversed polarity starts low for the duration of the duty cycle and goes high for the remainder of the period.”…””}”(hj-hj+hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K™hjþhžhubh¸)”}”(hXDrivers are encouraged to implement ->apply() instead of the legacy ->enable(), ->disable() and ->config() methods. Doing that should provide atomicity in the PWM config workflow, which is required when the PWM controls a critical device (like a regulator).”h]”hXDrivers are encouraged to implement ->apply() instead of the legacy ->enable(), ->disable() and ->config() methods. Doing that should provide atomicity in the PWM config workflow, which is required when the PWM controls a critical device (like a regulator).”…””}”(hj;hj9hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K hjþhžhubh¸)”}”(hŒÒThe implementation of ->get_state() (a method used to retrieve initial PWM state) is also encouraged for the same reason: letting the PWM user know about the current PWM state would allow him to avoid glitches.”h]”hŒÒThe implementation of ->get_state() (a method used to retrieve initial PWM state) is also encouraged for the same reason: letting the PWM user know about the current PWM state would allow him to avoid glitches.”…””}”(hjIhjGhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K¥hjþhžhubh¸)”}”(hŒŠDrivers should not implement any power management. In other words, consumers should implement it as described in the "Using PWMs" section.”h]”hŒŽDrivers should not implement any power management. In other words, consumers should implement it as described in the “Using PWMs†section.”…””}”(hjWhjUhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K©hjþhžhubeh}”(h]”Œimplementing-a-pwm-driver”ah ]”h"]”Œimplementing a pwm driver”ah$]”h&]”uh1h¡hh£hžhhŸh¶h KŠubh¢)”}”(hhh]”(h§)”}”(hŒLocking”h]”hŒLocking”…””}”(hjphjnhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¦hjkhžhhŸh¶h K­ubh¸)”}”(hXhThe PWM core list manipulations are protected by a mutex, so pwm_get() and pwm_put() may not be called from an atomic context. Currently the PWM core does not enforce any locking to pwm_enable(), pwm_disable() and pwm_config(), so the calling context is currently driver specific. This is an issue derived from the former barebone API and should be fixed soon.”h]”hXhThe PWM core list manipulations are protected by a mutex, so pwm_get() and pwm_put() may not be called from an atomic context. Currently the PWM core does not enforce any locking to pwm_enable(), pwm_disable() and pwm_config(), so the calling context is currently driver specific. This is an issue derived from the former barebone API and should be fixed soon.”…””}”(hj~hj|hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K¯hjkhžhubeh}”(h]”Œlocking”ah ]”h"]”Œlocking”ah$]”h&]”uh1h¡hh£hžhhŸh¶h K­ubh¢)”}”(hhh]”(h§)”}”(hŒHelpers”h]”hŒHelpers”…””}”(hj—hj•hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¦hj’hžhhŸh¶h K¶ubh¸)”}”(hŒêCurrently a PWM can only be configured with period_ns and duty_ns. For several use cases freq_hz and duty_percent might be better. Instead of calculating this in your driver please consider adding appropriate helpers to the framework.”h]”hŒêCurrently a PWM can only be configured with period_ns and duty_ns. For several use cases freq_hz and duty_percent might be better. Instead of calculating this in your driver please consider adding appropriate helpers to the framework.”…””}”(hj¥hj£hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K¸hj’hžhubeh}”(h]”Œhelpers”ah ]”h"]”Œhelpers”ah$]”h&]”uh1h¡hh£hžhhŸh¶h K¶ubeh}”(h]”Œ$pulse-width-modulation-pwm-interface”ah ]”h"]”Œ&pulse width modulation (pwm) interface”ah$]”h&]”uh1h¡hhhžhhŸh¶h Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”h¶uh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)”}”(h¦NŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”jäŒerror_encoding”ŒUTF-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”h¶Œ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œ embed_images”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”(j¾j»jjjúj÷jûjøjhjejjŒj¶j³uŒ nametypes”}”(j¾NjNjúNjûNjhNjNj¶Nuh}”(j»h£jhÕj÷jjøjýjejþjŒjkj³j’uŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”…”R”Œparse_messages”]”Œtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nhžhub.